How to match any combination of letters using regex?

html, java, javascript, perl, regex

Solution

Use regex pattern

\b(?!\w*(\w)\w*\1)[abc]+\b

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

Example:

(above output is from myregextester)

Problem

How can I match letters a,b,c once in any combination and varying length like this: The expression should match these cases: ``` abc bc a b bca ``` but should not match these ones: ``` abz aab cc x ```

Original source

Related problems