dhcrusoe Posted January 6, 2009 Share Posted January 6, 2009 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 Quote Link to comment Share on other sites More sharing options...
.josh Posted January 6, 2009 Share Posted January 6, 2009 Do you expect only linebreaks and whitespace? As in, no other tags? Just do the same thing as you did with your other pieces. preg_match('{</span>[^<]*<cite[^>]*>([^<]+)</cite>}', $html, $match); Quote Link to comment Share on other sites More sharing options...
dhcrusoe Posted January 6, 2009 Author Share Posted January 6, 2009 That works, thanks! Do you expect only linebreaks and whitespace? As in, no other tags? Just do the same thing as you did with your other pieces. preg_match('{</span>[^<]*<cite[^>]*>([^<]+)</cite>}', $html, $match); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.