I am using regex to validate input within a Google form, the input value should only contain the following formats . For example should work but or should not. I have tried to use the following regex
But this does not limit to the following input
>Solution :
You could shorten it to an alternation, and not that SSDC66765 has 5 digits so the quantifier can be {3,5} instead (or adjust to your needs)
^(?:SS(?:FW|DC)?|[HT]R)\d{3,5}$
The pattern matches:
^Start of string(?:Non capture groupSS(?:FW|DC)?Match either SS SSFW or SSDC|Or[HT]RMatch either HR or TR
)Close non capture group\d{3,5}Match 3 – 5 digits$End of string