After using 'aabcc'.match(/(\w)\1+/g)
to find repeated pairs of letters, I'm now looking to update my regex to specifically identify non-adjacent pairs. Any suggestions on how to achieve this?
For instance:
- The string
'aabcc'
is great because it contains two non-adjacent pairs of letters. - However, the string
'aacc'
does not meet the criteria for a good string.