AndyPSV Posted December 7, 2011 Share Posted December 7, 2011 I'VE GOT. Quote question_comment 42 51 553 12 55421 answer_comment 3221 321 12 145 667 post_comment 12321 1212 1221 1212 11 1 I WANT. get everything which is after variable, let it be for example: answer_comment, so the result needs to be: Quote 3221 321 12 145 667 so we theoretically delete the variable and we take all until the next "\r\n\r\n" how to do that any preg_match? Link to comment https://forums.phpfreaks.com/topic/252661-how-to-extract-very-simple/ Share on other sites More sharing options...
joe92 Posted December 7, 2011 Share Posted December 7, 2011 You will need to use a look-behind. Be aware a look-behind has to be a fixed length (i.e. not a pattern). It would go something like: [This is untested] <?php $variable = 'answer_comment'; preg_match("/(?<=$variable)[^A-Za-z]+/sm", $subject, $match); That's looking for something that begins with the variable and is not letters and can happen between one and infinity times. Hope that helps, Joe Link to comment https://forums.phpfreaks.com/topic/252661-how-to-extract-very-simple/#findComment-1295269 Share on other sites More sharing options...
AndyPSV Posted December 7, 2011 Author Share Posted December 7, 2011 thank you. Link to comment https://forums.phpfreaks.com/topic/252661-how-to-extract-very-simple/#findComment-1295277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.