# $rgx3 is untested, but provided for example. # see note below my $rgx3 = qr/\G # Global Anchor (?<=\.\ ) # Pattern for start of sentence ( # $1 (\ +)? # Extra leading spaces ? (.*?\.) # $2 - the sentence )/x; # end $1 and regex