How do you match group differences in JavaScript?

A regex /^[a-z]*$/

is a fast way to match all characters in a range.

But how can I remove a group of characters from this range?

For example, which regex matches a-z

with e,o,u

excluded?

Of course I can manually place multiple ranges, but I'm wondering if there is a better way?


EDIT. A similar but broader question is not specific to JavaScript. However JavaScript has a special relationship with regular expressions, for example here . Many expressions from other languages ​​don't work in JavaScript, so I feel that some of the more specific JS questions deserve some credit.

+3


source to share


1 answer


Place your answer here so that this question doesn't show up as unanswered:

/^(?:(?![oeu])[a-z])*$/

      



Credit goes to TJ Crowder

+1


source







All Articles