Regular Expressions – some tips

I keep on creating regular expression that I think should go but don’t :-(

Here are a couple of pointers I’ve found useful:

#### Five Habits for Successful Regular Expressions ####
The article at – http://www.onlamp.com/lpt/a/4101 this shows how you can break up regular expressions over multiple lines and add comments to make things intelligible – at last. Regular expressions as usually written are horrible, all on one line and no explanation. Here is how to do something about it, in PHP (wonderful language), Perl …

####Using Regular Expressions in Microsoft Word####
Strange as it sounds, you can not only use wildcards in Microsoft Word, but also use the parts of the input text that matches a pattern as part of the replacement.

To do this:
* put parenthesis (brackets) around parts of the patterns,
* in the replacement string, use the markers \1 \2 .. \n – these correspond to the parenthesised parts of the input pattern. From memory this is actually in the help – been using Word for over fifteen years and didn’t know it was in there ….