- or download this
($match) = "The longest word" =~ /(\w+)/;
print $match;
- or download this
($match) = "Mrs Smith" =~ /(Mr|Mrs)/;
print $match;
- or download this
($match) = "/foo/bar" =~ m[.*/(.*)];
print $match;
- or download this
($match) = "foo/bar/baz" =~ m[.*?/(.*)];
print $match;
- or download this
($outer, $inner) = "/foo/bar" =~ m[(/(.+))*];
print $inner;