Now this is pretty cool, other than Javascript not supporting it... The RegEx Lookbehind. You can find a pattern and return hits only when it's not preceded by another pattern.

So I wanted to find where something was declared in a web/javascript app, not where it was instantiated by pulling it back by id. In this case, we're using the ExtJS framework (probably not my first choice, but a good, robust lib), so document.getElementById() or a jQuery $() is replaced by Ext.getCmp().

So I want to find any example of theObject that's not in the format...

Which is to say, I want to find any theObject not preceded by Ext.getCmp("

Here's the lookbehind-ige...

SHAZAM. That's neat.

And though it'll chew, JEdit will recursively Hypersearch that into a directory tree, no problems.

And then it'll clue me in that I need to say either " or ' in the regexp. Ooops.



Labels: ,