Jump to content

[SOLVED] Regex for HTML (so close, yet so far!)


dhcrusoe

Recommended Posts

Hey guys,

 

I have a regex that pulls the vote for this html:

 

<div class="vote">number</div>

 

which is:

preg_match('{<div class="vote[^>]*>([^<]+)</div>}', $html, $match);

 

However, now we need to capture this html:

 

</span>
              
              <cite>Mobilize mentors, tutors, and “citizen teachers” to help kids succeed</cite>

 

with a </span> and a line break (and apparent spacing) between the </span> and <cite>. So the regex I was playing with was:

 

preg_match('{</span><cite[^>]*>([^<]+)</cite>}', $html, $match);

 

but it hasn't been working... any thoughts?

 

Thanks!

--Dave

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.