$ perl -MYAPE::Regex::Explain -le'die YAPE::Regex::Explain->new(qr/(\ +b\w+)\1\b/)->explain' The regular expression: (?-imsx:(\b\w+)\1\b) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- \b the boundary between a word char (\w) and something that is not a word char ---------------------------------------------------------------------- \w+ word characters (a-z, A-Z, 0-9, _) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- \1 what was matched by capture \1 ---------------------------------------------------------------------- \b the boundary between a word char (\w) and something that is not a word char ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
In reply to Re: Prog. Perl 3rd Ed. Regex Question
by Anonymous Monk
in thread Prog. Perl 3rd Ed. Regex Question
by makar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |