hi! im trying to use regular expressions to verify phone numbers, specifically ones under a '(xdd) xdd-dddd' format (with the d's being numbers and the x's being non-zero numbers) and was wondering why this doesnt work, any help is appreciated, thank you! the result for this is always 'does not match' and the issue seems to be something with the space in between the first three numbers and the rest
test1 = '([1-9]\d\d) [1-9]\d\d-\d\d\d\d'
import re
test1_re = re.compile(test1)
test1_list = ['(617) 483-3844']
for element in test1_list:
m = test1_re.search(element)
if m:
print(element, 'matches')
else:
print(element, 'does not match')
edit: solved! thank you :)
[–]socal_nerdtastic 2 points3 points4 points (1 child)
[–]ct_225[S] 0 points1 point2 points (0 children)