MacBook, defective by design banner

title:
Put the knife down and take a green herb, dude.

descrip:
One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com

Self-Pimpin':
Member of an email list?
You need The Digest Handler!!


FOR ENTERTAINMENT PURPOSES ONLY!!! Back-up your data and always wear white.
URLs I want to remember:
* Atari 2600 programming on your Mac
* joel on software (tip pt)
* resume, mostly for Google * Regular Expression Introduction (copy)
* gpl xbrowser API for dhtml
* mulder (old css tutorial)
* Using CommonDialog in VB 6 * Free zip utils
* that hardware vendor review site I forget about is here * Javascript 1.5 ref
* Read the bits about the zone * w3c.org index of HTML 4.01 elements
* Giant ASCII Textifier * Quick intro to Javascript
* Editable Firefox Page * Parsing str's in VB6
email if ya gotta, RSS if ya wanna RSS
 
 
Thursday, January 12, 2012

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...
Ext.getCmp("theObject")

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

Here's the lookbehind-ige...
(?<!Ext\.getCmp\(")theObject

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.

(?<!Ext\.getCmp\(["|'])theObject

Cool.

Labels: ,


posted by ruffin at 1/12/2012 12:34:00 PM
0 comments


All posts can be accessed here:


Support freedom
Last year o' posts:



Powered by Blogger furthurnet.org