Can't work out Regex expression

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,047
Office Version
  1. 2016
Platform
  1. Windows
I am pulling of some Phone numbers off a few sites. However the current Regex expression clips some of the numbers. Does anyone know how to write one for global numbers and not just UK

Current expressions
VBA Code:
"(?:\+1)?(?:\+[0-9])?\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{3}?)"

Results
1596202479624.png

As you can see numbers in Green have some digits missing.
 

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,832
Office Version
  1. 2010
Platform
  1. Windows
I googled " regular expression test" this morning and found many sites that let you test your regex codes. Some sites even have the option to choose the language you want to test the code in.
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499
for testing your regex RegexBuddy (free) can be used :cool:

there is much more features in RegexMagic & RegexBuddy
 

Watch MrExcel Video

Forum statistics

Threads
1,126,939
Messages
5,621,723
Members
415,853
Latest member
Newlife72

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top