in reply to Re: Extract a pattern from a string
in thread Extract a pattern from a string
I used the "|" as regex delimiter, to avoid the "leaning toothpicks" syndrome - ie to avoid having to escape the "/".
But doing that to avoid LTS puts you in danger of succumbing to STD (Straight Toothpick Distemper) the first time you use an | alternation in your regex. Why not just use a pair of nesting delimiters, { } for e.g., and be immunized against many of these pathologies?
$s =~ m{ (\d{1,2}) / (\d{1,2}) / (\d{1,2}) }xmsg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Extract a pattern from a string
by NetWallah (Canon) on Jun 11, 2012 at 14:01 UTC |