Here are some common search patterns you might require. Feel free to adjust them according to your needs.
A typical North American phone number is commonly indicated like this:
We will build the regex to find this pattern a piece at a time ...
First: look for 1 leading '(' parenthesis.
We have a regex that satisfies that condtion:
Now we adjust it to look for a single opening parenthesis '(', followed by 3 digits, followed by a single closing parenthisis ')', and a single space.
This one does that:
Next we need three digits for the exchange . . .
And the hyphen between exchange and phone . . .
This one:
Finally, 4 digits at the end, after the hyphen:
Last one:
Now you try:
Enter a phone number formatted thus: (or not)