http://regexr.com?32uvo
What I currently have:
\b(?=[A-Z\d]{10})(?:[A-Z]*\d){0,2}[A-Z]*\b
This would only match a string with a length of 10. I would like to change it to between 9 and 10 characters, where 2 can be numbers. Why doesn't this work?
\b(?=[A-Z\d]{9,10})(?:[A-Z]*\d){0,2}[A-Z]*\b
AFAIK, {9,10}
should be the length interval.
You were close
\b(?=[A-Z\d]{9,10}\b)(?:[A-Z]*\d){0,2}[A-Z]*\b
--
|->you missed this
try it here
So this regex would match a word that contains 9 to 10 characters[upper case and digits] that contain 1 to 2 digits
if you want to match the whole string you better use ^
(start of the string) and $
(end of the string)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With