gregjacobs / Autolinker.js

Utility to Automatically Link URLs, Email Addresses, Phone Numbers, Twitter handles, and Hashtags in a given block of text/HTML
MIT License
1.48k stars 238 forks source link

why if i enter 1234567890 as number then not showing as tel #221

Open mobileias opened 6 years ago

mobileias commented 6 years ago

hello

i try to use this as type tel and if i enter 1111111111 or 1234567890 or any it not shows a link for type tel

http://greg-jacobs.com/Autolinker.js/examples/live-example/

i try above example url

simison commented 6 years ago

Here's the current phone number regexp:

https://github.com/gregjacobs/Autolinker.js/blob/b8c7043f3a44b35282217aa14c71f9d49a12ec39/src/matcher/Phone.js#L13-L28

ynaftali-vonage-zz commented 5 years ago

The number 12345678901 doesn't get linked, but if I write it in any other format such as 1 2345678901 OR 1234 5678901 OR 1234567 8901, it does get linked. @simison Can you assist, please?

gregjacobs commented 5 years ago

Autolinker tries to be a little smart about what it links. It would be a bit silly to just autolink any number the utility finds as a telephone number, even if it is the same number of digits as a telephone number in 'x' country.

As such, Autolinker requires a little bit of formatting of the telephone number to distinguish it as a telephone number vs. some other random number. Adding a 1 with a space autolinks for that reason, since 1 is a country code. It should handle other properly-formatted (i.e. human readable) telephone numbers. If it doesn't handle a certain format though, let me know so I can add it.

ynaftali-vonage-zz commented 5 years ago

@gregjacobs - We've got 2 issues: Every non-us number isn't handled if you don't add the plus sign + country code. For example:

As a UK/AUS user, I wouldn't write a local number with the plus sign. I'd write it as written above.

In addition, we had an issue with US numbers handling:

Is this something the can be changed? Can you please look into it?

gregjacobs commented 5 years ago

Hey @ynaftali, thanks for the explanation. You might be right that unformatted numbers should be handled, as I suppose if someone wants to put in a numeric value, they should separate pairs of 3 with either a comma or a dot (ex: $1,000,000)

Can you help me understand UK/AUS numbers a bit better? Do you always need to dial 0 before the number?

I'll see what I can do about the US numbers that aren't handled. Thanks!

ynaftali-vonage-zz commented 5 years ago

@gregjacobs - A UK number can consist of the country calling code (+44), an international call prefix (00) and the trunk prefix (0) - So you'll always need to dial 0 before the number, for both national and international calls. The case is similar for AUS - A AUS number can consist of the country calling code (+61), an international call prefix (0011) and the trunk prefix (0) - So you'll always need to dial 0 before the number, for both national and international calls.

More details about numbers structures and formats can be found here:

gregjacobs commented 5 years ago

Hey @ynaftali, thanks for the info. I may have some time to work on this over my short vacation this week. I'll let you know!

ptman commented 5 years ago

We have a reverse problem. Finnish SSN equivalents are linked. They are very clearly not Finnish phone numbers. "It consists of eleven characters of the form DDMMYYCZZZQ, where DDMMYY is the day, month and year of birth, C the century sign, ZZZ the individual number and Q the control character (checksum). The sign for the century is either + (1800–1899), - (1900–1999), or A (2000–2099)" https://en.wikipedia.org/wiki/National_identification_number#Finland . Any suggestions how to prevent them from being linked?