in reply to Re: Variable-width negative lookbehind
in thread Variable-width negative lookbehind

..or for a quick match, substr, and tr///d:
$string =~ /^Y?X?/; substr($string, $+[0]) =~ tr/X//d;

The PerlMonk tr/// Advocate