Perlblog entries for 2010-06

Readable Regexps: Why you should use /x

Date: Wednesday, 2 June 2010, 09:53.

Categories: perl, ironman, regexp, craft, basic, tutorial.

Regexps are one of Perl's strongest features, but they're also one of the causes of Perl's greatest criticism: that it looks like line noise.

If you've ever had to examine someone else's regexp, or worse debug one, you'll probably agree that there's some merit in that criticism.

It doesn't have to be that way however, there's some simple steps you can take to make your regexps more readable and more maintainable, and this week we look at one of them: the /x modifier.

Browse Perlblog Subscribe to Perlblog

By day of June: 02

By month of 2010: March April May June July August September November

By year: 2010 2011

Or by: category or series.

© 2009-2011 Sam Graham, unless otherwise noted. All rights reserved.