在这里,我正在尝试提取电话号码。来自电子邮件
</tr>
<tr>
<td height=3D"20" valign=3D"bottom" style=3D"font-s=
ize:10px; color:#817f80;padding:0px;margin:0px;">1-877-435-2623 | Mon-Fri 8=
am-5pm, Sat-Sun 8am-12pm PST</td>
</tr>
<tr>
<td height=3D"35" valign=3D"bottom" style=3D"font-s=
ize:10px; margin:0px; margin-top: 10px; padding:0px; padding-bottom:0px; co=
lor:#939393;">© 2012 Elance, Inc. | 441 Logue Ave. Suite 150 | Mounta=
in View, CA 94043</td>
</tr>
<tr>
<td height=3D"20" valign=3D"bottom" style=3D"font-s=
ize:10px; margin:0px; margin-bottom:25px; padding:0px; color:#939393;"><a h=
ref=3D"https://www.elance.com/q/legal"><span style=3D"color:#939393;text-de=
coration:none;">Terms of Service</span></a> | <a href=3D"https://www.elance=
.com/p/legal/privacy-policy.pdf"><span style=3D"color:#939393;text-decorati=
on:none;">Privacy Policy</span></a> | All Rights Reserved.</td>
</tr>
</table>
<div style=3D"margin: 0; padding: 0;">
<a href=3D"http://www.facebook.com/elance"><img src=3D"=
https://www.elance.com/images/4.0/referral/facebook-btn-16x16.png" border=
=3D"0" alt=3D"Facebook" title=3D"Facebook" /></a>
<a href=3D"http://www.twitter.com/elance"><img src=3D"h=
ttps://www.elance.com/images/4.0/referral/twitter-btn-16x16.png" border=3D"=
0" alt=3D"Twitter" title=3D"Twitter" /></a>
<a href=3D"http://www.linkedin.com/company/elance"><img=
src=3D"https://www.elance.com/images/4.0/nav/nav_logo_sprite/icon-li.gif" =
border=3D"0" alt=3D"LinkedIn" title=3D"LinkedIn" /></a>
<a href=3D"http://www.youtube.com/elance"><img src=3D"h=
ttps://www.elance.com/images/4.0/nav/nav_logo_sprite/icon-yt.gif" border=3D=
"0" alt=3D"Youtube" title=3D"Youtube" /></a>
</div>
</td>0345-5407008
345-5124587
124-541-2215
+92-3455412412
3251452114
009124125413
hello world its my no. 03005134012
</tr>
</tbody>
</table>
</DIV>
</BODY>
</HTML>
--PHP-alt-3fbbc9acbecd103566642de6249238ea--
--PHP-mixed-3fbbc9acbecd103566642de6249238ea--
251254125
使用正则表达式
?(\d|\+)(\+|\d|\(|\)|-| |\.){7,25} ?
但我想忽略在这些字符串中找到的匹配项
--PHP-alt-3fbbc9acbecd103566642de6249238ea--
--PHP-mixed-3fbbc9acbecd103566642de6249238ea--
试试http://rubular.com/r/b6K0LOcn3N
任何更好的正则表达式???
对我的正则表达式的解释:?(\d|\+)(\+|\d|\(|\)|-| |\.){7,25} ?
- 开始抓不。仅在检测到空格或非空格时。
- 如果 first 是 0-9 或 + 匹配 (+|\d|(|)|-| |.) 中的任何字符,则开始匹配
- 7,25 因为电话号码的迷你长度。是 7 并且
- 最多约 25 个,包括空格和 - 等