

Understanding Regular Expressions 2: Groups and Captures - liquidise
http://blog.benroux.me/understanding-regular-expressions-2-groups-and-captures/

======
junto
Python and .NET also have named groups/captures. I find that particularly
useful when dealing with more complex expressions.

[http://www.regular-expressions.info/named.html](http://www.regular-
expressions.info/named.html)

~~~
liquidise
Very true. I plan on writing about those in a coming post, along with zero-
widths and look aheads/behinds. It has been a challenge trying to distill such
a powerful tool into its logical building blocks, without biting off too much
in any individual post.

------
zo1
Comment on a tangent.

I often find people absolutely baffled, and at the same time amazed at regular
expressions. I am, of course, referring to my coworkers, whom I try to
convince to at least _attempt_ at using regular expressions. Unfortunately, no
matter how many cheat-sheets I print and handout, or how many times I wow them
with simple yet powerful regular expressions, they resort to using the
proverbial brute-force hammer that they know.

Has anyone had any positive luck with convincing/converting coworkers into
using more regular expressions?

~~~
leeoniya
just show them the equivalent amount of code that includes the lexer/parser
and validation logic that can be summarized by even a simple regex.

aversion to regex is like aversion to SQL. sometimes declarative saves
literally hundreds of lines of hard-to-understand, poorly optimized code.

~~~
liquidise
i used to try this, but young programmers especially tend to just leave
thinking "regex is so powerful but i don't know it", which was likely their
mindset going in anyway.

------
georgiecasey
RegexBuddy is the best €30 I spent for speeding up and testing expressions.
Pity it doesn't support OBjC though.

