my $last= $string =~ /.*(PATTERN)/s;
but
my $last= ( $string =~ /(PATTERN)/g )[-1];
or (first technique fixed in two different ways)
my $last= $string =~ /.*(PATTERN)/s ? $1 : undef; # or my( $last )= $string =~ /.*(PATTERN)/sg;
- tye
In reply to Re: Get the last occurence of a pattern (2)
by tye
in thread Get the last occurence of a pattern
by nandn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |