Skip to main content

Posts

Showing posts from July, 2014

Learning regular expressions from Damian Conway

This is the best description I've ever seen on regular expressions.

http://www.infoq.com/presentations/regex

I would say the main thing I learned was that my understanding of regular expressions was incorrect and that I have assumed non-greedy matching.  I know now that I should add the suffix '?' which provides this behavior.

Also, it is sad that there are at least 6 kinds of regular expressions (VIM, Gnu Emacs, GREP, PERL 5, Perl 6, etc.)  I notice that Lua has yet another.  I miss the simplicity of REXX.


parse var telephone '(' area ')' npx '-' line


Thank you Damian!

As always, Jamie Zawinsky's rule applies.

Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.