If I correctly understand the problem, you can do this using either:
or$string =~ s/([^Y])X+/$1/g;
depending on whether "YXX" should yield "YX" or be left unchanged.$string =~ s/([^YX])X+/$1/g;
Hugo
In reply to Re: Variable-width negative lookbehind
by hv
in thread Variable-width negative lookbehind
by dragonchild
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |