Let's say we have the following regular expression:
((a(.+?)c ?)+)
This will match:
abc acc aac
What I want to do:
((a(.+?)c ?)(a\3c ?)*)
So that i will only match
abc abc abc
or
acc acc acc
but not item #2 (abc acc aac)
... But without the backreference.
Basically, I want the 3rd capturing group in #1 (.+?) to always match whatever the first match had.
Is this possible?
To make things hairier, this will need to work in JavaScript's regexp engine.
((a(.+?)c ?)(a(.+?)c ?)(a\3c ?)*)