regex code assistance for entering 600 in a input field
-
Hello I was trying to understand how to work with a regex expression for when a User enters starts typing in 600 in the input field, then populate the error message. What would be the regex code for that?
Currently I have `^[\w'\-,.][^0-9_!¡?÷?¿\/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$` -
Hello I was trying to understand how to work with a regex expression for when a User enters starts typing in 600 in the input field, then populate the error message. What would be the regex code for that?
Currently I have `^[\w'\-,.][^0-9_!¡?÷?¿\/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$` -
thank you for your reply:
Main thing is if customer enters a credit card like 1111222233334444 that is ok, but if customer enters a credit card number that starts with 600 and then other characters then it should be validated. ex: 6001222233334444
-
thank you for your reply:
Main thing is if customer enters a credit card like 1111222233334444 that is ok, but if customer enters a credit card number that starts with 600 and then other characters then it should be validated. ex: 6001222233334444
-
In that case it would be easier just to check if the first 3 characters are "600"; and you can do that with a simple string method in most languages.
How would I do that? I tried with
^600
but it instead it didnt show that error but got rid of it. I want to show the error when customer enters 600 first and any numbers after.
-
How would I do that? I tried with
^600
but it instead it didnt show that error but got rid of it. I want to show the error when customer enters 600 first and any numbers after.
Looks like you're specifying the pattern for valid values, rather than invalid values. Try:
^([^6]|6[^0]|60[^0])
Regexper[^] regex101: build, test, and debug regex[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
How would I do that? I tried with
^600
but it instead it didnt show that error but got rid of it. I want to show the error when customer enters 600 first and any numbers after.