catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.8k stars 216 forks source link

findPhoneNumbers can't find a phone number if there exists text before or after it (country: JP) #410

Open takapiya opened 3 years ago

takapiya commented 3 years ago

Steps to reproduce

  1. open demo page
  2. typing text that exists text before or after phone number (e.g 0312345678foobaa 09011112222)

Observed result

Phone numbers found: 1
0312345678foobaa 09012345678
Number: +819012345678, Country: JP, Starts at: 17, Ends at: 28

Expected result

Phone numbers found: 2
Number: +81312345678, Country: JP, Starts at: XX, Ends at: XX
Number: +819011112222, Country: JP, Starts at: XX, Ends at: XX

Google's demo link

"Parse" is able to parsed that phone number. https://libphonenumber.appspot.com/phonenumberparser?number=0312345678&country=JP https://libphonenumber.appspot.com/phonenumberparser?number=09011112222&country=JP

catamphetamine commented 3 years ago

Hi. Finding numbers in text and parsing a single phone number are different functions. Google doesn't provide an online demo for finding numbers in text. I'd suppose the bug you've described is somewhere in Google's code, so you could report that to them if you manage to reproduce it in one of the languages they support for calling that function (Java, C++).

takapiya commented 3 years ago

Hi.

Finding numbers in text and parsing a single phone number are different functions.

understand that. I just wanted to let you know that the format of the phone number is not wrong.

I'd suppose the bug you've described is somewhere in Google's code

hmm, ok. I've never used java and c++, but I'll look into it.

thank you for your reply:)

catamphetamine commented 3 years ago

understand that. I just wanted to let you know that the format of the phone number is not wrong.

Ok, we can leave this bug open then.