我正在寻找正则表达式代码来获取电话号码并删除不需要的字符。从电话号码字符串中删除不需要的字符
import re
strs = 'dsds +48 124 cat cat cat245 81243!!'
match = re.search(r'.[ 0-9\+\-\.\_]+', strs)
if match:
print 'found', match.group() ## 'found word:cat'
else:
print 'did not find'
它只返回:
+48 124
我怎样才能返回整个多少?
非常感谢! – Efrin
但是如果某些数据具有阿尔法数字条目并且我们需要两个字母数字数据但不包括额外的括号或逗号。 – 2014-09-30 14:06:02