I am new to regular expressions but I hope to build some competance on the subject. For now though I am just a newbie.
I am trying to create a regex were the haystack is expected to be small (only 10 characters or less), and a match is to be confirmed when the subject string fits the full length of the haystack. Here is the regex I have created in PHP...
$number = preg_match("/^(N[CGLRSX]{0,1}[0-9]{1-3}[A-Z]{0,2})$/", $aCR);
When I provide the values "N1Z" for $aCR, I expect to get a value of 1 for $number, but instead I get 0. Hmmmm.... What it looks straight forward, but obviously I am doing something wrong. Can anyone point out the error of my ways?
Thanks in advance for any assistance you can provide.
Mike