Saturday, April 3, 2010


Are you having a hard time catching on to the use of SREs?  You are not alone.  Since their very inception, regular expressions have been difficult for developers to learn.  One of the primary reasons is the fact that there are so many flavors of RegEx engines out there and a regular expression that works in Javascript (example only) won't necessarily work in .NET (example only) or AutoIt.

There are many Reg tools available but the big question with each is "What engine is the tool designed for."  Since we are primarily concerned with those that work with AutoIt, I will mention a couple that come close in most cases.
RegEx Buddy
RegEx Coach

I have one that was originally released by a couple of forum members and I have been constantly modifying it to suit my purposes.  This one is explicitly for AutoIt and as far as I know has never been tested with any other language.  Since the engine used by AutoIt is the PCRE engine then it should also work with Perl but no guarantees there.  AutoIt has a few idiosyncrasies that make it just a touch different from normal PCRE regex's.  Right now I've only made this tool available by request via a PM.  That will change at some point and I'll make it available on one of my webs (that will most probably be my AutoIt Central site).  It will always continue to be free and open source as a way to partially pay back to the AutoIt community and in keeping with the intent of the original authors.  My hope is that there will be a public release within the next month but I must first do some more work on the snippet holder.  Originally a list control was used and I'm changing it to a listview instead.  I'm also hoping to get a menu included that will allow you to insert common matching code like (?i) and (?s) as well as the groups like [:alpha:] etc.

If you have specific issues with a regular expression, I suggest that you post it as a question in the AutoIt forums.  You will generally get a working version that does what you expected.

In the meantime don't get frustrated when you first attempt SREs.  The light will suddenly come on and you will be off to the races.  One thing that is becoming very pronounced is the tendency of some people to over think the regexp.  many are posting regular expression's which are far to complex for the situation at hand.  Keep it simple and you will have much more success.

If you are looking for a specific RegEx try searching on one of my favorite sites, The Regular Expression Library.
If you have any questions or suggestions for content on this post, please use the comments link.

No comments: