Link to home
Create AccountLog in
Avatar of brian_leighty
brian_leighty

asked on

RegEx for a string.....

I have an ID number that is in the form of:

1. 5 digits (0-9)
2. two letters (either a IN of GS)
3. 4 digits (0-9)

example: 73745IN0000

Does anybody know how to create a RegEx for this character string.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of ZeonFlash
ZeonFlash

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Fernando Soto
Hi brian_leighty;

The following string pattern will find the characters string you are looking for.

string pattern = "\d{5}(?:IN|GS)\d{4}";

Fernando
Avatar of brian_leighty
brian_leighty

ASKER

Sorry Fernando I just accepted ZeonFlash solution!
Not a problem. ;=)