ToonMariner Posted June 1, 2006 Share Posted June 1, 2006 Each time I think I get these something happens which indicates i dont.OK I have a html file that a place contents into a string using file_get_contents.now I want to return from the string everything from '<center><br>' upto and including '</textarea>' which have tags inbetween and newlines etc. etc.Now I have tried preg_match('/<center><br>.\s*<\/textarea>/', $string, $outstr);preg_match('/<center><br>(?!<\/textarea>).\s*<\/textarea>/', $string, $outstr);and some other embarrassing combinations.Bit of help would be very much appreciated. Link to comment https://forums.phpfreaks.com/topic/10914-reg-ex/ Share on other sites More sharing options...
hvle Posted June 1, 2006 Share Posted June 1, 2006 try this:preg_match("/<center><br>.*?<\/textarea>/",$string, $outstr);$outstr[0] will contains everything between but not included '<center><br>' and '</textarea>'pregmatch is non greedy and it will stop at the first </textarea>.Also, you need to use double quote to specify the pattern string. PHP will not parse escape char with single quote.Tom Link to comment https://forums.phpfreaks.com/topic/10914-reg-ex/#findComment-40783 Share on other sites More sharing options...
ToonMariner Posted June 1, 2006 Author Share Posted June 1, 2006 Thanks for reply but unfortunately no joy there - output array is empty.Any other suggestions? Link to comment https://forums.phpfreaks.com/topic/10914-reg-ex/#findComment-40856 Share on other sites More sharing options...
samshel Posted June 1, 2006 Share Posted June 1, 2006 Try this...preg_match("`<center><br>(.*)</textarea>`",$string,$outstr); Link to comment https://forums.phpfreaks.com/topic/10914-reg-ex/#findComment-40858 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.