Regular Expressions Python Tutorial

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