dsaba Posted May 7, 2007 Share Posted May 7, 2007 normally i'm looking in a string for this ''. thats two single quotes followed by a period and I replace it with this "" which is nothing so thats <?php $string = str_replace("''.", "", $string); ?> problem is, that I don't want to replace ''. when there is a \ before it all for example I want to replace ''. but not \''. so I know this can probably done with regex, how can I do it? with preg_replace ?? -thanks Quote Link to comment https://forums.phpfreaks.com/topic/50368-solved-some-simple-regex-help/ Share on other sites More sharing options...
effigy Posted May 7, 2007 Share Posted May 7, 2007 echo preg_replace("/(?<!\\\)''./", '', "\''."); Quote Link to comment https://forums.phpfreaks.com/topic/50368-solved-some-simple-regex-help/#findComment-247330 Share on other sites More sharing options...
dsaba Posted May 7, 2007 Author Share Posted May 7, 2007 thanks effigy but I believe you misread my question I wanted to replace ''. with "" nothing your regex looks for \''. and replaces it with \''. i want the regex to only look for ''. and not \''. , and replace it with "" nothing Quote Link to comment https://forums.phpfreaks.com/topic/50368-solved-some-simple-regex-help/#findComment-247333 Share on other sites More sharing options...
dsaba Posted May 7, 2007 Author Share Posted May 7, 2007 n/m Quote Link to comment https://forums.phpfreaks.com/topic/50368-solved-some-simple-regex-help/#findComment-247358 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.