I am creating an input form on a web page. That's on field in phone number get in user.now How can I check now if the user's phone number is a wallet? my user lives in bangladesh.
CodePudding user response:
you can use regex to check mobile phone:
^\ ?(88)?0?1[3456789][0-9]{8}\b
CodePudding user response:
If you are trying to implement real world project phone validation then there are two ways I know that can be used :-
After basic regex check on the phone number, you can.....
(i) setup an OTP based system so that user has to fill OTP on your page that was sent to his phone number to validate the number.
(ii) use a phone number validator api if you just want to check if the number is correct or not and belongs to a particular country. There are many free web api's present that you can use in your project.
CodePudding user response:
You can use this function for that:
function validatePhone(phone){
let p = ^\ ?(88)?0?1[3456789][0-9]{8}\b;
return p.test(phone);
}