wolves Posted April 12, 2006 Share Posted April 12, 2006 how to replace, [b]\\[/b] to [b]\[/b] and [b]\[/b] to [b]nothing[/b] using preg_replace?if someone knows a tutorial of regular expresions.. tell me...tks Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 12, 2006 Share Posted April 12, 2006 try this...[code]<?php$lookfor = array('/\\\\/','/\\/');$repwith = array('\\','');$string = preg_replace($lookfor,$repwith,$string);?>[/code]where $string is the string you want to do the replacement on. Quote Link to comment Share on other sites More sharing options...
obsidian Posted April 12, 2006 Share Posted April 12, 2006 [!--quoteo(post=363994:date=Apr 12 2006, 08:00 AM:name=wolves)--][div class=\'quotetop\']QUOTE(wolves @ Apr 12 2006, 08:00 AM) [snapback]363994[/snapback][/div][div class=\'quotemain\'][!--quotec--]how to replace, [b]\\[/b] to [b]\[/b] and [b]\[/b] to [b]nothing[/b] using preg_replace?if someone knows a tutorial of regular expresions.. tell me...tks[/quote][a href=\"http://www.regular-expressions.info\" target=\"_blank\"]http://www.regular-expressions.info[/a]also, if that's what you're after, why not just use stripslashes()? Quote Link to comment Share on other sites More sharing options...
wolves Posted April 12, 2006 Author Share Posted April 12, 2006 [!--quoteo(post=363999:date=Apr 12 2006, 07:17 AM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Apr 12 2006, 07:17 AM) [snapback]363999[/snapback][/div][div class=\'quotemain\'][!--quotec--]also, if that's what you're after, why not just use stripslashes()?[/quote]yeah, it's make my life easier.. I thought that it will strip all \, but nottks, all! 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.