Finding the Extension : Search : Regular Expressions PYTHON TUTORIALS


PYTHON TUTORIALS » Regular Expressions » Search »

 

Finding the Extension


import re 
phonePattern = re.compile(r'^(d{3})-(d{3})-(d{4})-(d+)$') 
print phonePattern.search('000-888-1234-1234').groups()                  
print phonePattern.search('000 888 1234 1234')                          
print phonePattern.search('000-888-1234')



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Regular Expressions
» Search