if (preg_match ("/1[2][3-6][37|67][7-9][L|N]\d\d\d\d\d\d/", $VIN)) {
echo "1967 - 1969 VIN entered";
} else {
echo "NOT a VALID 13 digit VIN entered";
exit;
}
This should be saying the following:
1st char = 1
2nd char = 2
3rd char = 3 - 6
4th & 5th chars = 36 or 67
6th char = 7 - 9
7th char = L or N
8th - 13th chars = NUMBERS
The problem resides in the [36|37]
How do I specify I want it to allow "36" or "67"?
preg_match not working
Moderator: General Moderators
-
camarosource
- Forum Commoner
- Posts: 77
- Joined: Sat Aug 03, 2002 10:43 pm
are you sure that's right?
i believe that's just 4th 4 or 5.
to have both, change (37|67) to (37|67){2}
or to [37,67]{2} or to [37,67][37,67]
the reason is didn't work in [] the first time but worked in () is becasue | is or and can only work in a setting that you're captuning the or. the reasonb it will owk in the [] that i gave is becasue mine is tsaying the range is comprised of those numbers (note how i use a , instead of a |)
i believe that's just 4th 4 or 5.
to have both, change (37|67) to (37|67){2}
or to [37,67]{2} or to [37,67][37,67]
the reason is didn't work in [] the first time but worked in () is becasue | is or and can only work in a setting that you're captuning the or. the reasonb it will owk in the [] that i gave is becasue mine is tsaying the range is comprised of those numbers (note how i use a , instead of a |)