I need to match the following strings and returns the values as groups:
abctic
abctac
xyztic
xyztac
ghhtic
ghhtac
Pattern is wrote with grouping is as follows:
(?<arch>[abc,xyz,ghh])(?<flavor>[tic,tac]$)
The above returns only parts of group names. (meaning match is not correct).
If I use *
in each sub pattern instead of $
at the end, groups are correct, but that would mean that abcticff will also match.
Please let me know what my correct regex should be.