in reply to Extended Regex Sequences
If you remove the star, the second regex works; if you change it to a plus, and modify the data to have multiple closing brackets, it still works.
The problem is that since the regex can match on zero closing brackets, it does so at the beginning of the string. Since the previous character is not an opening bracket, the search portion succeeds, and the replace portion replaces the empty match with an empty string. If you modify the second datum to begin with a closing bracket, you'll see that it gets edited the way you wanted.
If you change the regex to operate globally, you'll get the effect I think you want. Add a 'g' at the end:
$_ =~ s/[)]*(?<![(])//g;
--
TTTATCGGTCGTTATATAGATGTTTGCA
|
|---|