Lumio Posted April 11, 2007 Share Posted April 11, 2007 Hi! I have a string like foo=bar xy*21 bar=foo ***// here - it ends to the next row Now, when I try to make it like this... <?php preg_match('{(.+?)\-(.+)}', $s, $match); print_r($match); ?> ... it only puts out Array ( [0] => here - it ends [1] => here [2] => it ends ) But I want to get something like Array ( [0] => foo=bar xy*21 bar=foo ***// here - it ends to the next row [1] => foo=bar xy*21 bar=foo ***// here [2] => it ends to the next row ) Link to comment https://forums.phpfreaks.com/topic/46565-solved-using-multiline/ Share on other sites More sharing options...
Lumio Posted April 11, 2007 Author Share Posted April 11, 2007 preg_match('{([\w\d\s[:punct:]]+?)-([\w\d\s[:punct:]]+)}', $s, $match); works, but I want to use every sign until the - and also every sign after - Link to comment https://forums.phpfreaks.com/topic/46565-solved-using-multiline/#findComment-226653 Share on other sites More sharing options...
wildteen88 Posted April 11, 2007 Share Posted April 11, 2007 use the s pattern modifier instead. preg_match('{(.+?)\-(.+)}s', $s, $match); pattern modifiers go after the ending delimiter for the pattern. Link to comment https://forums.phpfreaks.com/topic/46565-solved-using-multiline/#findComment-226717 Share on other sites More sharing options...
Lumio Posted April 11, 2007 Author Share Posted April 11, 2007 thanks a lot Link to comment https://forums.phpfreaks.com/topic/46565-solved-using-multiline/#findComment-226750 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.