Help for this page

Select Code to Download


  1. or download this
    $string =~ s/(?<!Y)(?<!^)X//g;
    
  2. or download this
    my $rstr = reverse $string;
    $rstr =~ s/X(?!Y|\Z)//g;  # note \Z, not $
    $string = reverse $rstr;
    
  3. or download this
    # old:
    # $string =~ s/([^Y])X/$1/g;
    # new:
    $string =~ s/[^Y]\KX//;