Skip to content
Advertisement

How to match any combination of letters using regex?

How can I match letters a,b,c once in any combination and varying length like this:

The expression should match these cases:

JavaScript

but should not match these ones:

JavaScript

Advertisement

Answer

Use regex pattern

JavaScript

You can use this pattern with any set and size, just replace [abc] with desired set…


Example:

enter image description here

(above output is from myregextester)

Advertisement