bluesoul Posted December 16, 2008 Share Posted December 16, 2008 Ugh, I'll be the first to admit that regex isn't my strong suit and I may not even need it for this but I don't think substr will do it. Say I have a line that reads... request.type: domain.transfer.request I need to take everything after the colon and space and store it as a string. request.type: is constant, the text after it is not, and there will usually be lines above and below request.type. Link to comment https://forums.phpfreaks.com/topic/137256-solved-after-colon-to-end-of-line/ Share on other sites More sharing options...
rhodesa Posted December 16, 2008 Share Posted December 16, 2008 if(preg_match('/request\.type:\s+(.+)/',$text,$matches)){ print $matches[1]; } edit: added request.type to the regex Link to comment https://forums.phpfreaks.com/topic/137256-solved-after-colon-to-end-of-line/#findComment-717108 Share on other sites More sharing options...
bluesoul Posted December 16, 2008 Author Share Posted December 16, 2008 Works perfect, thanks so much. Link to comment https://forums.phpfreaks.com/topic/137256-solved-after-colon-to-end-of-line/#findComment-717141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.