ikin Posted October 25, 2010 Share Posted October 25, 2010 Well I'm stuck... So I'm trying to make the php print out the text between title="Text here" <?php function Betweens($string) { $pattern = '/title="(.*?)"/'; //It fails here preg_match($pattern, $string, $matches); return $matches[1]; } $str = '<iu pageid="2022" ns="0" title="Test" />'; $p = Betweens($str); echo $p; ?> So yea I really suck at regex's.. Edit: God damn it, now I see I've posted in wrong sector -.- Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted October 25, 2010 Share Posted October 25, 2010 it works for me. When I run that I see the word Test Quote Link to comment Share on other sites More sharing options...
tastro Posted October 25, 2010 Share Posted October 25, 2010 replace this: $pattern = '/title="(.*?)"/'; //It fails here with this: $pattern = '/title\=\"(.*?)\"/i'; //It fails here and if this doesn't work... then try to change the \" to \' best regards, tastro 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.