prakash Posted January 26, 2008 Share Posted January 26, 2008 I need just to allow a-z, A-Z, 0-9 and space on my preg_replace rule. so could anyone let me know what I must have to modify from below ??? ??? preg_replace("/[^a-zA-Z0-9s]/", "", $data); Quote Link to comment https://forums.phpfreaks.com/topic/87940-solved-preg_replace-help/ Share on other sites More sharing options...
amites Posted January 26, 2008 Share Posted January 26, 2008 all these posts in the general help section for regex when there is a whole forum dedicated to regex? Quote Link to comment https://forums.phpfreaks.com/topic/87940-solved-preg_replace-help/#findComment-449938 Share on other sites More sharing options...
laffin Posted January 26, 2008 Share Posted January 26, 2008 preg_replace("/[^a-zA-Z0-9 ]/ms", "", $data); you were matching the literal 's' i think u meant to use \s (whitespace) which includes \t \r \n and of cource space Quote Link to comment https://forums.phpfreaks.com/topic/87940-solved-preg_replace-help/#findComment-449940 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.