sKunKbad Posted January 5, 2008 Share Posted January 5, 2008 I have a need to strip out \r\n AND \t, but can't use \s or my string becomes unusable. Right now I have: $menu=preg_replace("|\r\n|", "", $menu); $menu=preg_replace("|\t|", "", $menu); It doesn't seem like it would be efficient, but I don't know of any other way to do what I need to do. Is this OK? Quote Link to comment https://forums.phpfreaks.com/topic/84648-solved-preg_replace-question-about-whitespace/ Share on other sites More sharing options...
toplay Posted January 5, 2008 Share Posted January 5, 2008 Not tested, but this should work fine: $menu = preg_replace('/\n|\r|\t/', '', $menu); Quote Link to comment https://forums.phpfreaks.com/topic/84648-solved-preg_replace-question-about-whitespace/#findComment-431389 Share on other sites More sharing options...
effigy Posted January 5, 2008 Share Posted January 5, 2008 /[\r\n\t]/ Quote Link to comment https://forums.phpfreaks.com/topic/84648-solved-preg_replace-question-about-whitespace/#findComment-431453 Share on other sites More sharing options...
sKunKbad Posted January 6, 2008 Author Share Posted January 6, 2008 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/84648-solved-preg_replace-question-about-whitespace/#findComment-431714 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.