$re = '/(?x)(
# phone number
(\+1)?
(\s)?
(\(\d\d\d\))? #area code optional
(\s|-) # first separator
\d\d\d # first 3 digits
- # Separator
\d\d\d\d # last 4 digits
)/mX';
$str = '+1 (786) 665-5397
+1 (786) 773-7145
+1 (786) 804-8869
+1 (786) 806-5097
+1 (786) 856-7950
+1 (786) 862-2875
+1 (786) 915-7830
+1 (786) 991-4304
+1 (857) 334-1162
+1 (862) 944-0090
+1 (863) 307-5291
+1 (914) 826-4343
+1 (918) 992-1382
+1 (954) 226-7037';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php