Help for this page

Select Code to Download


  1. or download this
    $_ = 'ab abc abcd abcde';
    
    /a.*b/;  # $& = 'ab abc abcd ab'
    /a.*?b/; # $& = 'ab'
    
  2. or download this
    $src =~ s/<record.*?>/$&$new_tag/;            # No newlines matched
    $src =~ s/<record[\w\s\n-="%]*?>/$&$new_tag/; # All-inclusive class?
    $src =~ s/<record[^>]*>/$&$new_tag/;          # Probably best