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
In reply to Re^2: Match only last occurrence
by BillKSmith
in thread Match only last occurrence
by sotona
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |