PDA

View Full Version : Need help with REx.



libertux
24 Dec 2009, 11:58 AM
Good evening,

I'm trying to study the ExtJS/docs code, i succeed to load the "ApiPanel" tree nodes from a MySQL Data Base, Now i need to filter the tree but i have some trouble,



var re = new RegExp('^' + Ext.escapeRe(text), 'i');


can some one tell me what the given code mean? i don't understand the given Reg.Exp.

THKS

MaximGB
24 Dec 2009, 4:01 PM
text variable contains a filtering string which may contain any characters even those which have special meaning for regular expressions, like '[' or '.' or '*' etc. Ext.escapeRe() method escapes those characters by prepending them with '\' character.

jaime_
26 Dec 2009, 7:13 AM
i don't understand the given Reg.Exp.

Check this out: http://net.tutsplus.com/tutorials/javascript-ajax/you-dont-know-anything-about-regular-expressions/

^ matches the beginning of a line.