For anyone who is having trouble with regular expressions, I suggest you have a look at this site by Jeff Avallone. It takes a regular expression in the native (cryptic) format and produces a visual display of the same expression. For example,




and the pattern for an email address




One caveat - you will see


expanded as


which may seem incorrect at first glance, however, the 2...4 times refers not to the number of digits but the number of extra "trips" back through the loop so if you have three digits you require two extra trips back through. I recently suggested to the author that he consider labelling the iterators something like 3...5 occurrences which would be both clear and precise.

In any case, this is a valuable tool for debugging complex expressions.

Nutster commented: Good link and explanation, but the Email address pattern needs to escape the period between groups 2 and 3. +7
ddanbe commented: Great tip! Thanks :) +15
cereal commented: thank you! +14
JamesCherrill commented: Wow - that's really useful. Thanks +15
rproffitt commented: 2..4 times or more useful. Molsen OK by you? +12