Help for this page

Select Code to Download


  1. or download this
    my $a = "x|xx|xx|xxxx|xx|xxx|xx|xx|x";
    $a =~ s/(?<=\|)xx(?=\|)/x x/g;
    print "[$a]\n";
    __DATA__
    [x|x x|x x|xxxx|x x|xxx|x x|x x|x]
    
  2. or download this
    $a = 'xx|xx|xx';
    # should this be (use example above):
    ...
    # combined with the first part gives you some real perl line noise
    # if you want it all in a single regex
    $a =~ s/^xx(?=\|)|(?<=\|)xx(?=\|)|(?<=\|)xx$/x x/g;