user4122308 user4122308 - 15 days ago 8
C# Question

Regex to split id's

Hi I am trying to write a regualr expression so a string can be split on the above ID's.

T follow by 9 digits (eg. T123654789)
or
S followed by 9 digits (eg. S123654789)
or
E followd by 9 digits (eg. E123654789)


I have this but does not seem to work.

"^[S][0-9]{9}?$|^[T][0-9]{9}?$|^[E][0-9]{9}?$"


This works on regxr.com but not in my programme

"/([S]|[E]|[T])[1-9]{9}/g"

Answer

How about [TSE]{1}[0-9]{9} Hope it helps.