This only does a lookahead after finding an 'x', which ought to be faster than doing a lookahead for each character (which is what /^(?:(?!xyz).)*$/s based solutions do). Of course, the performance difference may not be relevant for you. If needed, the lookahead can entirely be eliminated, but that requires a more complicated regexp - and then I would have to think./^[^x]*(?:x(?!yz)[^x]*)*$/
In reply to Re: match with exception
by JavaFan
in thread match with exception
by vit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |