- or download this
($last_numbers) = $string =~ /(\d+)(?!\D*\d)/;
- or download this
$last_numbers = scalar reverse( # reverse the match
reverse($string) =~ # reverse the input string
/(\d+)/ # reverse the regex
);
- or download this
$CODE =~ m{
\A
...
)*
\z
}x;
- or download this
<this is a sample program> int x = 10;
<what a silly grammar> str y = "cool \" beans";
...
chop(y,x);
print "I sliced 'y' down to ", x, " characters for you";
}
- or download this
($last_comment) = $CODE =~ m{
\A
...
(?: "[^"\\]*(?:\\.[^"\\]*)*" | (?>[^"<>]*) )*
\z
}x;
- or download this
$last = scalar reverse(reverse($CODE) =~ m{
\A
...
(?: "(?:[^"\\]*.\\)*[^"\\]*" | (?>[^"<>]*) | >[^>]*< )*
\z
}x);
- or download this
($last_comment) = $CODE =~ m{
(<[^>]*>)
(?: "[^"\\]*(?:\\.[^"\\]*)*" | (?>[^"<>]*) )*
\z
}x;
- or download this
$last = scalar reverse(reverse($CODE) =~ m{
\A
(?: "(?:[^"\\]*.\\)*[^"\\]*" | (?>[^"<>]*) )*
(>[^>]*<)
}x);