perldoc -f open
####
The regular expression:
(?-imsx:\b[Ii]t\b(.*)[.,?]$)
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):
----------------------------------------------------------------------
\b the boundary between a word char (\w) and
something that is not a word char
----------------------------------------------------------------------
[Ii] any character of: 'I', 'i'
----------------------------------------------------------------------
t 't'
----------------------------------------------------------------------
\b the boundary between a word char (\w) and
something that is not a word char
----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
.* any character except \n (0 or more times
(matching the most amount possible))
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
[.,?] any character of: '.', ',', '?'
----------------------------------------------------------------------
$ before an optional \n, and the end of the
string
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
####
#!/usr/bin/env perl
use warnings;
use strict;
use YAPE::Regex::Explain;
my $re = '\b[Ii]t\b(.*)[.,?]$';
my $parser = YAPE::Regex::Explain->new($re);
print $parser->explain;