Home > database >  For excepting some character in Range
For excepting some character in Range

Time:12-20

I'm wondering how to apply to Regex range with some character.

For example, I want to find except english character without "o, r, z",

[^orz] can find other language or number character.

Is [a-np-qs-y] only the answer?

Isn't there any answer like [a-Z^orz]? (Of course I know this is wrong.)

CodePudding user response:

You can use:

(?:(?![orz])[a-z]) 

Demo & explanation

CodePudding user response:

Depending on the language, you could also make use of Character Class Subtraction:

For example in Java:

[a-y&&[^or]]

Regex demo

  • Related