dsaba Posted December 27, 2007 Share Posted December 27, 2007 <?php $str = '" \\an//d " " \\an//d "'; echo "$str<br>"; $pat = '~(" )(\\an//d)( ")~e'; preg_match_all($pat, $str, $out); print_r($out); ?> outputs: " \an//d " " \an//d "<br> Array ( [0] => Array ( ) [1] => Array ( ) [2] => Array ( ) [3] => Array ( ) ) Why doesn't it match? (read it carefully) Quote Link to comment Share on other sites More sharing options...
dsaba Posted December 27, 2007 Author Share Posted December 27, 2007 ah here is why I changed this: $pat = '~(" )(\\an//d)( ")~e'; to this: $pat = '~(" )(\\\an//d)( ")~e'; you have to escape for the pattern itself, and then again for the string declaration solved 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.