use strict; use warnings; use YAPE::Regex::Explain; my $regex = qr/foo # Match starting at foo (?: # Complex expression: (?!baz) # make sure we're not at the beginning of baz . # accept any character )* # any number of times bar # and ending at bar /x; my $explanation = YAPE::Regex::Explain->new($regex)->explain; print $explanation;