regex Найти весь французский номер телефона Python
^(?:(?:\+|00)33[\s.-]{0,3}(?:\(0\)[\s.-]{0,3})?|0)[1-9](?:(?:[\s.-]?\d{2}){4}|\d{2}(?:[\s.-]?\d{3}){2})$
Careful Cobra
^(?:(?:\+|00)33[\s.-]{0,3}(?:\(0\)[\s.-]{0,3})?|0)[1-9](?:(?:[\s.-]?\d{2}){4}|\d{2}(?:[\s.-]?\d{3}){2})$
^
(?:(?:\+|00)33|0) # Dialing code
\s*[1-9] # First number (from 1 to 9)
(?:[\s.-]*\d{2}){4} # End of the phone number
$
# install package:
2
pip install phonenumbers
3
4
# code:
5
import phonenumbers
6
from phonenumbers import geocoder
7
from phonenumbers import carrier
8
9
number = '+917417622184'
10
ch_number = phonenumbers.parse(number, "CH")
11
print(geocoder.description_for_number(ch_number, "en"))
12
service_provider = phonenumbers.parse(number, "RO")
13
print(carrier.name_for_number(service_provider, "en"))
# install package:
2
pip install phonenumbers
3
4
# code:
5
import phonenumbers
6
from phonenumbers import geocoder
7
from phonenumbers import carrier
8
9
number = '+XXXXXXXXXX'
10
ch_number = phonenumbers.parse(number, "CH")
11
print(geocoder.description_for_number(ch_number, "en"))
12
service_provider = phonenumbers.parse(number, "RO")
13
print(carrier.name_for_number(service_provider, "en"))