regex pattern to match string in any order
<p>How to find first match of string <code>abc</code> in shuffled order using regex pattern in java? </p>

<p>Example:</p>

<p>input 1: abcbaa<br>
input 2: bcbaaa<br>
input 3: cbaaab<br></p>

<p>1st match for input 1 : <b>abc</b>baab<br>
1st match for input 2 : b<b>cba</b>aab<br>
1st match for input 3 : <b>bca</b>aabc<br></p>

<p>Patterns that I've tried that didn't work:</p>

<pre><code>(?:([abc])(?!\\.*]\\1)){3}
(?!(.)\\1)[abc]{3}
</code></pre>

<p>The above 2 patterns matches 3 consecutive characters, including duplicate values.<br>example: <i><b>aba</b>bac</i><br>expected: <i>aba<b>bac</b></i></p>

<pre><code>(?=.*[abc])(?=.*[abc])(?=.*[abc])
</code></pre>

<p>This one matches and empty character in-between each character. i.e., string position (0,0), (1,1), (2,2) etc... </p>