I just after some help constructing a regular expression check on the following sequence in C#. I need to ensure the value entered matches the following format.
NNNNCCCCCCCCNNNNNNN
2000AAAAAAAA0001001
Thanks for any help on this
Brendan
I just after some help constructing a regular expression check on the following sequence in C#. I need to ensure the value entered matches the following format.
NNNNCCCCCCCCNNNNNNN
2000AAAAAAAA0001001
Thanks for any help on this
Brendan
[0-9]{4}[A-Z]{4}[A-Z]{4}[0-9]{4}[0-9]{3}
If you want to be able to grab each set as a group for processing you need to add ( ) around each pattern.
([[0-9]{4})([A-Z]{4})([A-Z]{4})([0-9]{4})([0-9]{3})
This will allow you to recover each set of characters from the match without having to re-parse the string again. If you need that.
Oh and if the first set of digits cannot start with a zero
[1-9][0-9]{3}[A-Z]{4}[A-Z]{4}[0-9]{4}[0-9]{3}
zs instead of big Zs. Also, does C# allow \d in place of [0-9] like Ruby does?