I am trying to match the following string in Javascript Regex
PC123456
This is what I have:
/^PC\d*/
This works for every instance minus one with a space after the “PC” which does work but it should fail.
Example:
PC 123456
That should fail. What do I need to add to make the second condition fail?
Change your regex to this:
This requires at least one digit and only matches if there is nothing else in the string except the
PCand the digits.This will match:
It will not match: