import re
phone = re.compile(r'\d\d\d-\d\d\d-\d\d\d\d')
mo = phone.search('my phone is 415-111-2345')
print(mo.group())
结果是:
415-111-2345
import re
phone = re.compile(r'\d\d\d-\d\d\d-\d\d\d\d')
mo = phone.search('my phone is 415-111-2345')
print(mo.group())
结果是:
415-111-2345