$ perl -MYAPE::Regex::Explain -e " print YAPE::Regex::Explain->new( qr{\A ipv6 | alt \Z}imxs )->explain " The regular expression: (?imsx:\A ipv6 | alt \Z) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?imsx: group, but do not capture (case-insensitive) (with ^ and $ matching start and end of line) (with . matching \n) (disregarding whitespace and comments): ---------------------------------------------------------------------- \A the beginning of the string ---------------------------------------------------------------------- ipv6 'ipv6' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- alt 'alt' ---------------------------------------------------------------------- \Z before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- #### [Visual of regex at 'rxrx' line 0] [step: 5] \A Match only if at start of string ipv6 Match a literal sequence ("ipv6") | Or... alt Match a literal sequence ("alt") \Z Match only if at end of string (or final newline)