dpacmittal Posted September 15, 2009 Share Posted September 15, 2009 I want to extract text till a fullstop or a question mark but they should not be inside a tag. I did this: preg_match("!(<.*?>)?.*?(\.|\?)!s",$string,$matches); print_r($matches); It worked for some pages, and didn't work for others. Most of the times it extracts till a <a href=http://example. stopping at the dot in web address. Need some guidance on this. Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 15, 2009 Share Posted September 15, 2009 ~^.*?[.?](?![^<]*?>)~s Explanation here: http://www.phpfreaks.com/forums/index.php/topic,257050.msg1209420.html#msg1209420 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.