The title may not best describe what I'm trying to do (couldn't think of a better way to word it nicely).
I'm looking to use the exec() function to capture groups where the count for one character is equal to the count of another. For example, using characters x and y:
xx&yy [match: x count = 2, y count = 2]
xx&yx&&yy [match: x count = 3, y count = 3]
xyxx&&&y [match: x count = 1, y count = 1] [no match: x count = 2, y count = 1]
Is this possible to do?