我一直在玩这个,我只剩下这个......
preg_match_all('/<p>(.*?)<br>(.*?)<p>/s', $offices, $district);
哪个工作正常......但当然有一个记录会导致问题。如何指定和获取<p>
标签中包含<br>
的所有文本?最好在 Eddy Lite 标签<br>
内指定一个以上,但不包括在内?<p>
该字符串是一个地址,例如:
<h3>District Offices:</h3>
<p>
317 Dun Avenue<br>Suite 17<br>Port Samson, AK 32675<br>
(XXX) XXX-XXXX<br>
VOIP: 40800<br>
FAX (888) xxx-38xx<br>
</p>
<h4>Staff Assistants:</h4>
<p>Beth Booger and Ly Sweet</p>
<h4>Secretary:</h4>
<p>Eddy Lite </p>
<p>
OK City Hall<br>110 S.E. Five Avenue<br>3rd Floor<br>Corpse, AK 33371<br>
(xxx) 694-xxxx<br>
</p>
<h4>Staff Assistant:</h4>
<p>Con Sims </p>
<br />
<h3>Home Office:</h3>
这就是我要返回的内容: Array ( [0] => Array ( [0] => 317 Dun Avenue Suite 17 Port Samson, AK 32675 (XXX) XXX-XXXX
Staff Assistants:
[1] =>
Eddy Lite
OK City Hall
110 S.E. Five Avenue
3rd Floor
Corpse, AK 33371
(xxx) 694-xxxx
Staff Assistant:
) )
任何帮助将不胜感激。我试过:preg_match_all('/
(.*?)
/s', $offices, $district); preg_match_all('/
(.*)
/s', $offices, $district); preg_match_all('/
(. ?)
(. ?)
/', $offices, $district); preg_match_all('/
(. ?)
(. ?)
(.*?)
/s', $offices, $district); preg_match_all('/
(. ?)
(. )
(.*)
/s', $offices, $district);