I have the following regular expression and I want the matching alternative of the first group to be the matching alternative of the second group.
(?i)^([a-z]+|\d+)-([a-z]+|\d+)$
Basically what I want is if \[a-z\] matches in the first group I want only that pattern to match the second group and if \\d matches in the first group I want only that pattern to match in the second group.
I tried with an expanded regular expression that had[a-z]+)-([a-z]+)|(\d+)-(\d+) but that gave me 4 groups either 1,2 or 3,4 with one set populated and the other set null.
I want to make it where there is always just groups 1,2 so I don't have to test to see which groups actually match.
Given the following input:
10-15
XX-ZZ
5-A
a-1000
10-15 should match
XX-ZZ should match
5-A should not match
a-1000 should not match