1. Computing
Michael Morin

Regular Expression Options

By November 30, 2013

Follow me on:

While many people think to learn the regular expression syntax inside and out, it's easy to forget about Regular Expression Options.  These options, while not always earth shatteringly useful, can often vastly simplify your regular expressions.

 

For example, the i option makes your regular expression case insensitive, meaning you don't have to repeat REPEAT yourself YOURSELF to match strings of differing cases.  And of course the x option allows you to make extended regular expressions, which can be spread over multiple lines and even contain comments.  This option turns unreadable character soup into elegant and well documented code.

Comments
No comments yet. Leave a Comment
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.