Wednesday April 11, 2007
Module of the Century: Sandip's Regular Expression Highlighter
It's not often that I post more than one blog entry in a day, so this means that what I have to share is pretty significant. I'm no hero when it comes to regular expressions, so I installed the NBM file from http://www.nbextras.org and then installed Sandip's Regular Expression Highlighter from the newly installed nbextras update center. I needed to construct a regular expression that would capture a "class" attribute in an xwork.xml file, together with its value. After that, even more challenging, I needed to construct a regular expression that would capture everything from an opening <action> tag to a closing </action> tag. So, I started typing in the text field that you see in the toolbar in the screenshot below. As I typed regular expressions, everything in the document that was captured by the expression was highlighted, while I was typing. Not soon after, through trial and error, I had my expression:
Result: class="[a-z."]*
Similarly, I constructed a regular expression for capturing my <action> tags, across multiple lines:
Result: <action [a-z0-9A-Z=" .>]*|<r[a-z=" .></]*|</action>
I realize the results do not cover all possibilities, nor are they perfectly formulated. But clearly they're a good start. Thanks Sandip! Very useful. It really is ideal for learning how regular expressions work. I hope it will be part of 6.0.
Apr 11 2007, 10:37:32 AM PDT Permalink
Pretty neat :)
Will try it immediately.
I have installed the older one; will use newer version soon.
By the way, I hope Geertjan doesn't mind us converting his blog into a chat template [And if he doesn't mind than may be he should collaborate the developer's collaboration module into his blog] ;)
if(Geertjan.status==frowning()){
bipin.status=ducking();
}
Posted by Geertjan on April 12, 2007 at 01:25 AM PDT #
The updates to nbextras are slow as the work is done manually by volunteers. That is why I have continued to have my own update center. That way I have full control.
Now NetBeans.org has plugin portal which allows uploding/updating...I will be switching to that some time in future.
Posted by Marco Slot on April 13, 2007 at 01:36 PM PDT #
http://plugins.netbeans.org/PluginPortal/
Posted by Sandip on April 13, 2007 at 05:45 PM PDT #
Posted by nbuser on April 17, 2007 at 11:27 AM PDT #
Posted by David Rozenberg on April 19, 2007 at 03:53 PM PDT #
Posted by Stephen on April 26, 2007 at 06:55 AM PDT #


