#! perl use strict; use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(shift)->explain; #### tilly@localhost:~$ perl re-explain foo The regular expression: (?-imsx:foo) 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): ---------------------------------------------------------------------- foo 'foo' ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- tilly@localhost:~$ perl re-explain '(foo|bar)' The regular expression: (?-imsx:(foo|bar)) 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: ---------------------------------------------------------------------- foo 'foo' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- bar 'bar' ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------