1

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

这是字符串:

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”号码、“Fax”号码和“Email”。

4

2 回答 2

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

There you go. The three submatches are your numbers.

于 2013-05-12T17:30:22.393 回答
1

如果您确定每个条目都有相同的顺序(电话、传真、电子邮件、站点),您可以使用以下命令:

$pattern = '~(?:Tél|Fax|Email): \K([\d ]++|.+?(?=Site web:))~';
于 2013-05-12T17:36:55.053 回答