Capturing type of phone number after the actual number

Hi there team, i have this regex that captures local US and international phone numbers,

[0-9,+,(), ,-]{1,}(,[0-9]+){0,}$

however the page that I am scraping has the type of phone number after it. It has a space, open parens, either the word ‘Cell’ or ‘Home’, close parens) is it possible to add to the regex to capture that part of the line. The data scraped is like this:
1234567890 (Home) or 1234567890 (Cell)
Appreciate in advance your help!

Hi @olmccb ,

can you provide the sample input for the regex and expected output.


hi there @arivu96 that is my input

1234567890 (Cell) or 1234567890 (Home)

expected output from this?

\d+ (\(Home\)|\(Cell\))



How about the following pattern?

[0-9,+,(), ,-]{1,}(,[0-9]+){0,}((?=\(\D+?\))|$)


thank you @arivu96 appreciate your help!

Yes Master Yoda (@Yoichi ) I needed that last extra piece!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.