07-20-2010 09:55 AM
Lately we have had a number of posts involving complex regular expressions. Although I am not nearly a regex expert, I am not at all against using such expressions. They can be a powerful shortcut at times. However, for the 99% of us who are not regex experts, I would like to propose that anyone who uses regex, please insert a detailed comment on what the expression does. This makes code easier to maintain and modify. Someday someone else may inherit your regex code. Please make it easy on them.
A small example of what I mean can be found here where Darrin K shows an expression, and gives a good explanation of what it does.
07-20-2010 10:27 AM
Great minds think alike but I beat you to it. ![]()
http://forums.ni.com/t5/BreakPoint/Regular-Expressions-Board/td-p/1187799
07-20-2010 10:53 AM
You spelled out regular expressions in full. That's why I didn't see it. I was looking for regex. ![]()
07-20-2010 09:17 PM - edited 07-20-2010 09:18 PM
@tbob wrote:
You spelled out regular expressions in full. That's why I didn't see it. I was looking for regex.
Perhaps, if the search engine used a synonym operator, like '~' on the Google Cheat Sheet, where a search for "regex" would return all matches for "regular expression", "regular expressions", "regex", or "regexes".
07-21-2010 11:05 AM
Besides all that, the real reason I posted was not to start a discussion on regex instances or the expressions themselves. This post was meant to ask people to fully document their expressions so that regex dummies (like me) can follow what the expression does. I would hate to inherit code with a complex expression that I can't decipher. So this post is just a plea.
07-21-2010 11:43 AM
I would agree that it would be nice to understand what they are doing too.