Say, for example, that I have the following data:
ab
cd
ef
zy
ba
cd
I want to be able to match this so that the first character matches, and then the second character matches based on the capture group of the first.
Each of the lines in the above example should match, while something like ccor afshould not be.
To understand what I think looks something like this:
(ruby based regex)
/^(?<first>[a-z])\g<first>$/
However, this is consistent with aaor acwhich would be invalid as well as implied ab.
Is there a way to change the capture group or surround it with syntax that does something similar to what I intend?