Help for this page

Select Code to Download


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