To see what is happening, tryuse YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr/.*(\d{6,8}).*/ )->explain,"\n"; __END__ The regular expression: (?-imsx:.*(\d{6,8}).*) 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): ---------------------------------------------------------------------- .* any character except \n (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- \d{6,8} digits (0-9) (between 6 and 8 times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- .* any character except \n (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
use re 'debug';
In reply to Re: Regex Quantifiers
by Anonymous Monk
in thread Regex Quantifiers
by FFSparky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |