Regular Expression Help

J

Jami

How i can define regular expression for following cases

A100123456, 1B00345787

1- here i want first two charcters as alphanumeric
2- next two characters must be 00 (zero)(zero)
3- next six characters must be numeric 0-9

what will be the regular expression for the above

Regards,

Jami
 
M

Martin Honnen

Jami said:
How i can define regular expression for following cases

A100123456, 1B00345787

1- here i want first two charcters as alphanumeric
2- next two characters must be 00 (zero)(zero)
3- next six characters must be numeric 0-9

what will be the regular expression for the above

@"[A-Z0-9]{2}00[0-9]{6}"
should give you an idea. The "[A-Z0-9]" might need to be adapted
depending on what exactly you regard as alphanumeric characters and
whether you also want to allow lower case letters.
And if you want to test that a string contains nothing but a string
matching above expression then you should add "^" at the beginning and
"$" at the end:
@"^[A-Z0-9]{2}00[0-9]{6}$"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Regular expression 5
One more regular expression 4
regular expression 4
Regular Expression Text 5
Regular Expression Help 3
regular expression 7
Regular Expression Help 2
Regular Expression 2

Top