in reply to What this pattern matches
$ perl -MYAPE::Regex::Explain -e 'print YAPE::Regex::Explain->new(qr/^ +(.+)_[^_]+$/)->explain' The regular expression: (?-imsx:^(.+)_[^_]+$) 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): ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- .+ any character except \n (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- _ '_' ---------------------------------------------------------------------- [^_]+ any character except: '_' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
-enlil
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: What this pattern matches
by zerogeek (Monk) on May 12, 2006 at 08:22 UTC | |
Re^2: What this pattern matches
by mikeock (Hermit) on May 12, 2006 at 15:37 UTC |