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? 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); 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]/ 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! 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
Archived
This topic is now archived and is closed to further replies.