in reply to Re: Match only last occurrence
in thread Match only last occurrence

Great response! I did not notice it when I wrote and tested much the same thing.
use strict; use warnings; use Test::Simple tests => 1; my $multi_line_string = "yadda text: 123 yadda yadda\n" . " text: 456 yadda\n" ; $multi_line_string =~ /\A .* (text\:\s\d{3}) /xms; my $expected = 'text: 456'; my $match = $1; ok( $match eq $expected, 'Match last occurrence'); OUTPUT: 1..1 ok 1 - Match last occurrence
Bill