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 ) Quote Link to comment 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 - Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Lumio Posted April 11, 2007 Author Share Posted April 11, 2007 thanks a lot 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.