php三个正则表达式

时间:2013-05-12 17:27:22

标签: php regex

我花了好几个小时试图去做但仍然无法正常工作。即使有其他主题,我也找不到解决方案。

这是字符串:

S.C.V. Ch. Latour (Exploitante) Latour Château Latour 33250 PauillacCordonnées GPS : 45.175167 -0.749777Tél: 05 56 73 19 80Fax: 05 56 73 19 81Email: s.favreau@chateau-latour.comSite web: http

我想得到三件事:“Tél”号码,“传真”号码和“电子邮件”。

2 个答案:

答案 0 :(得分:2)

/Tél: (.+)Fax: (.+)Email: (.+)Site/

你去吧。这三个子匹配是你的数字。

答案 1 :(得分:1)

如果您确定每个条目都有相同的订单(tél。,传真,电子邮件,网站),您可以使用:

$pattern = '~(?:Tél|Fax|Email): \K([\d ]++|.+?(?=Site web:))~';