|
Posted by Rik on 03/02/07 18:17
On Fri, 02 Mar 2007 18:16:38 +0100, Damo <cormacdebarra@gmail.com> wrote=
:
> I'm slowly getting the hang of regex's, Instead ive starting a new
> thread i thought id ask here. I have this regex:
>
> $regexp =3D "%<li><a href=3D\"(.+?)\">.+[^>]+>([^<]+)</a>.+<span class=
=3D
-------------------------------------^greedy dot--------^again
> \"date\">(.+?)</span>.+<div class=3D\"abstract\">(.+?)</div>%s";
------------------------^greedy dot
> It matches a the URL of a link, the text of a link, a date and the
> abstract of a story.
> If I use preg_match_all and theres multiple matches to the pattern in=
> a html string, it inly stores the last one in $matches
$regexp =3D '%<li>\s*
<a[^>]*?href=3D"([^"]+)"[^>]*>
(.*?)
</a>
..*?
<span[^>]*?class=3D"date"[^>]*>
(.+?)
</span>
..+?
<div[^>]*?class=3D"abstract"[^>]*>
(.+?)
</div>%six';
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|