$string = "---------xxxxxxxxxxxxxxx------yyyyyyyyyyyyyy--------"; $string =~ s/\A-+|-+$/?/g; [download]
In reply to What is wrong here (Replacing Strin pieces) by Anonymous Monk