http://www.perlmonks.org?node_id=207599


in reply to "Correct" program style questions

i have changed my regular expression style significantly as of late. my list of reasons includes training regex newbies and preparing for perl 6.

here are some of the changes

my take on your regexes might go something like:

... =~ m/(?x) \A ## match w/ capture: one or more alpha, punct, or space posix charac +ters ( [[:alpha:][:punct:][:space:]]+ ) \z /; ## and ... =~ m/(?x) \A ## match w/capture: one or more alpha posix characters ( [[:alpha:]]+ ) \z /;

the comments are a little verbose. i'd consider them extraneous for this example, but neccessary in more complex patterns.

~Particle *accelerates*