Handling Numbers Without Separators : Search : Regular Expressions PYTHON TUTORIALS


PYTHON TUTORIALS » Regular Expressions » Search »

 

Handling Numbers Without Separators


import re 
phonePattern = re.compile(r'^(d{3})D*(d{3})D*(d{4})D*(d*)$')  
print phonePattern.search('00088812341234').groups()                     
print phonePattern.search('000.888.1234 x1234').groups()                
print phonePattern.search('000-888-1234').groups()                        
print phonePattern.search('(000)8881234 x1234')



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Regular Expressions
» Search