Hi All,
I'm working on a mobile application where I'm facing a scenario. I have a input field where I'm filling in the mobile number with country code like (+213). So, If I try to delete the mobile number by using the backspace button, The country code should not be deleted if I continuously press back space button.
Hope you understand the problem. Any help will be appreciated.
Thanks
Prince
Hi, try for this
1)
var numericReg = /^[a-zA-Z0-9._]+|[\b]+$/
2)
var numericReg = /^(?:[a-zA-Z0-9._]|[\b])+$/
3) for numeric
var regExpr = new RegExp("^[0-9,\b][0-9,\b]*$");
4)
var numericReg = /^[a-zA-Z0-9._\b]+$/;
Hi Prince,
First, do you allow changing the country code at all? Is it fixed? If not, how can a user change the country code if not by backspace?
You could consider splitting the country code and phone number in two input fields.
That said, why do you need a regex? How are you going to use it to restrict the input?