I have to match sequence like baab, sdds in the string and the sequence should not be inside the square brackets. So far i have used the regular expression
/([a-z])([a-z])\2{1}\1{1}(?![^[]*])/
It is giving me the desired output but the above regular expression also matching the sequence like bbbb which is undesirable. I am thinking of having something to compare capture group1 and capture group2 not be equal.So far i didn't find anything useful.