use 5.012_002; use strict; use warnings; use YAPE::Regex::Explain; my $var1 = "This (is)- my first string"; my $var2 = "This (is)- my first string"; say YAPE::Regex::Explain->new($var2)->explain(); #### The regular expression: (?-imsx:This (is)- my first string) 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): ---------------------------------------------------------------------- This 'This ' ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- is 'is' ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- - my first string '- my first string' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------