Specific Phone Number Regular Expression

  numbers, python, re, regex

I am parsing text with only one phone number format: (###) ###-####

None of these worked…

re.findall(r"^(d{3}) d{3}-d{4}$", text)

re.findall(r"^(w{3})[s]w{3}[-]w{4}$", text)

re.findall(r"^(w{3}) w{3}-w{4}$", text)

Where am I going wrong?

Thank you

Source: Python Questions

LEAVE A COMMENT