PDA

View Full Version : core/Ext.js escapeRe()



papasi
12 Mar 2007, 12:16 AM
Hi,

I found a bug in escapeRe() when I used the ds.filter() function.

I replaced

escapeRe : function(s) {
return s.replace(/[.*+?^${}()|[\]\/\\]/g, "\\$0");
},


with


escapeRe : function(s) {
return s.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1");
},


and it worked.

I looked up the regex section of JavaScript The Definitive Guide and it did not mention $0 as a valid back reference syntax.

This is tested with FF 1.5.0.10

Thanks

jack.slocum
12 Mar 2007, 11:06 PM
Thanks I will drop that in.