I have to write a function that will get a string and it will have 2 forms:
XX..X,YY..YwhereXX..Xare max 4 characters andYY..Yare max 26 characters(X and Y are digits or A or B)XX..XwhereXX..Xare max 8 characters (X is digit or A or B)
e.g. 12A,784B52 or 4453AB
How can i user Regex grouping to match this behavior?
Thanks.
p.s. sorry if this is to localized
You can use named captures for this:
I don’t know what happens if there is no group Y, perhaps you might need to wrap the last line in an
ifstatement.