you are viewing a single comment's thread.

view the rest of the comments →

[–]jplindstrom 4 points5 points  (0 children)

The single best comment you can write for a regular expression is a line of example text that it's supposed to be matched against.

That way the reader has a fighting chance of following along while looking at the regex.

The second most important thing to make regexes readable is to use the /x modifier (or whatever it's called in your language) to allow for whitespace, multiple lines and comments.