validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

improve japanese mobile phone regex

Open sneznaj opened this issue 3 years ago • 2 comments

regex according to this page https://github.com/sakatam/a-better-jp-phone-regex

fixes #871

sneznaj avatar Aug 12 '22 22:08 sneznaj

Your change should work with the current tests, right? https://github.com/validatorjs/validator.js/blob/master/test/validators.js#L8268-L8306

WikiRik avatar Aug 13 '22 11:08 WikiRik

I see you have used the combined regex which matches fixed phones, IP phones and mobile phones. This is not the intended behaviour of isMobilePhone.

If you want to implement a new validator for landline phone numbers/all phone numbers, I would suggest that you open an issue to discuss that.

If there is an issue with the current mobile phone validator, I would suggest that you start over and add new cases to the tests to verify that it is not working correctly, and then rewrite/replace the regex.

braaar avatar Aug 15 '22 07:08 braaar

@sneznaj thanks for the PR, but as @braaar pointed out, introducing landline phone numbers into the isMobilePhone validator, is not correct. I'm marking this as "marked for close" and will close the issue, if I don't get any feedback within the next week, if that is OK with you.

pano9000 avatar Jan 23 '23 00:01 pano9000

as I haven't received any feedback, I'm closing the PR here, thanks for your effort though.

pano9000 avatar Jan 30 '23 19:01 pano9000