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); 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? 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 Link to comment https://forums.phpfreaks.com/topic/87940-solved-preg_replace-help/#findComment-449940 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.