in reply to Re: parsing question
in thread parsing question
Abigail's extended regular expression is also an opportunity to show you a nifty module called YAPE::Regex::Explain.
ladoix% cat 290992 #!/usr/bin/perl use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/_test(?>\s+)(?!<)/)->explain; ladoix% perl 290992 The regular expression: (?-imsx:_test(?>\s+)(?!<)) 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): ---------------------------------------------------------------------- _test '_test' ---------------------------------------------------------------------- (?> match (and do not backtrack afterwards): ---------------------------------------------------------------------- \s+ whitespace (\n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of look-ahead ---------------------------------------------------------------------- (?! look ahead to see if there is not: ---------------------------------------------------------------------- < '<' ---------------------------------------------------------------------- ) end of look-ahead ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
--
Allolex
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parsing question
by Abigail-II (Bishop) on Sep 12, 2003 at 12:50 UTC | |
by allolex (Curate) on Sep 12, 2003 at 13:06 UTC | |
by Abigail-II (Bishop) on Sep 12, 2003 at 13:13 UTC | |
by bart (Canon) on Sep 13, 2003 at 10:31 UTC |