in reply to Converting Regular Expressions to English
use YAPE::Explain::Regex; my $re = qr/foo*(?<=bar)+?(?:baz)?/; print YAPE::Regex::Explain->new($re)->explain; __output__ The regular expression: (?-imsx:foo*(?<=bar)(?:baz)?) 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): ---------------------------------------------------------------------- fo 'fo' ---------------------------------------------------------------------- o* 'o' (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- (?<= look behind to see if there is (1 or more times (matching the least amount possible)): ---------------------------------------------------------------------- bar 'bar' ---------------------------------------------------------------------- )+? end of look-behind ---------------------------------------------------------------------- (?: group, but do not capture (optional (matching the most amount possible)): ---------------------------------------------------------------------- baz 'baz' ---------------------------------------------------------------------- )? end of grouping ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
_________
broquaint
|
|---|