Sam's Blog entries for June 2010
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.