use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr/([^\r\n]+)$/s )->explain; __END__ The regular expression: (?s-imx:([^\r\n]+)$) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?s-imx: group, but do not capture (with . matching \n) (case-sensitive) (with ^ and $ matching normally) (matching whitespace and # normally): ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- [^\r\n]+ any character except: '\r' (carriage return), '\n' (newline) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------