I'm using this regex ^x{3}y{3}$
to check for example this string: xxxyyy
, where the number of x
's is the same as the number of y
's (in my example it is 3
). But the problem is that I don't know the number of repetitions (it is in range from 0
to 10
), so 3
has to be replaced with something abstract.
I can use ^x*y*$
or ^x{0,10}y{0,10}$
, but this will not work when the number of x
's is different from the number of y
's.
I'm looking for something like \1
, which is used for reusing of matched group, but in my case I want to reuse the number of group matches for x
.