- or download this
$str =~s/.*(John).*/$1/;
- or download this
$str =~s{.* / | \. .*}{}gx;
- or download this
$str =~s{ (?: [^/]* / ){5} ( \w+ ) .* }{$1}x;
- or download this
print $str =~ /(John)/;
print $str =~ m{ .* / (.+) \. }x;
print $str =~ m{ (?: [^/]* / ){5} ( \w+ ) }x;
- or download this
my $s = 'John';
print $s if -1 != index $str, $s;