in reply to Re: Trying to avoid line noise (brain cramp)
in thread Trying to avoid line noise (brain cramp)

On the same subject, don't forget about the "x"-modifier for regexen. It basically allows you to split a regex into multiple lines and comment on every line.

Allow me to quote from perlman:perlfaq6, Section 1


/x lets you turn this:

s{<(?:[^>'"]*|".*?"|'.*?')+>}{}gs;
into this:

s{ < # opening angle bracket (?: # Non-backreffing grouping paren [^>'"] * # 0 or more things that are neither > nor +' nor " | # or else ".*?" # a section between double quotes (stingy +match) | # or else '.*?' # a section between single quotes (stingy +match) ) + # all occurring one or more times > # closing angle bracket }{}gsx; # replace with nothing, i.e. delete
It's still not quite so clear as prose, but it is very useful for describing the meaning of each part of the pattern.

Again, hope that helps,
Brother Ade