BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Regex

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.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 1 of 6
(12,426 Views)

Great minds think alike but I beat you to it.  Smiley Tongue

 

http://forums.ni.com/t5/BreakPoint/Regular-Expressions-Board/td-p/1187799

Tim
GHSP
0 Kudos
Message 2 of 6
(12,415 Views)

You spelled out regular expressions in full.  That's why I didn't see it.  I was looking for regex. Smiley Wink

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 6
(12,408 Views)

 


@tbob wrote:

You spelled out regular expressions in full.  That's why I didn't see it.  I was looking for regex. Smiley Wink


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".

 

 

 

0 Kudos
Message 4 of 6
(12,379 Views)

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.

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 6
(12,341 Views)

I would agree that it would be nice to understand what they are doing too.

Tim
GHSP
0 Kudos
Message 6 of 6
(12,332 Views)