I have tried following regexp in cpp ^((T[X-Z]|R[X-Z])+?)(?:,\\s*|$). It validates only TX. If empty string it should be invalid, it should not accept numbers as well
User may enter:
- TX
- TX, TY
- TX, TY, TZ,
- RX, RY, RZ
- RX
It should be valid in all cases.
For the test cases that you put here,
([TR][XYZ])(,( )?)?might work.I have tested it for you here (Mention that
globalandmultilineflags are enabled)