How to find first match of string abc
in shuffled order using regex pattern in java?
Example:
input 1: abcbaa
input 2: bcbaaa
input 3: cbaaab
1st match for input 1 : abcbaab
1st match for input 2 : bcbaaab
1st match for input 3 : bcaaabc
Patterns that I've tried that didn't work:
(?:([abc])(?!\\.*]\\1)){3}
(?!(.)\\1)[abc]{3}
The above 2 patterns matches 3 consecutive characters, including duplicate values.
example: ababac
expected: ababac
(?=.*[abc])(?=.*[abc])(?=.*[abc])
This one matches and empty character in-between each character. i.e., string position (0,0), (1,1), (2,2) etc...