master82 Posted June 6, 2007 Share Posted June 6, 2007 I have a small mail system for my site, however I need to sanatise any use input... I an familiar with: <?php $output = preg_replace("/[^a-zA-Z0-9s]/", "", $input); ?> to restrict the input to text and numbers only, however, I need to also allow spaces, dots and commers. So could somebody help me add these into this? Thanks Link to comment https://forums.phpfreaks.com/topic/54467-stripping/ Share on other sites More sharing options...
eric1235711 Posted June 6, 2007 Share Posted June 6, 2007 http://www.regular-expressions.info/ Code: <?php $output = preg_replace("/[^a-zA-Z0-9.!?, ]/", "", $input);// and so on ?> Link to comment https://forums.phpfreaks.com/topic/54467-stripping/#findComment-269416 Share on other sites More sharing options...
master82 Posted June 6, 2007 Author Share Posted June 6, 2007 Thats the exact website I got the code above from a few months ago, but it doesnt say anything about keeping spaces, commers, fullstops, and i guess even brackets in the variable. (at least not what I can find) And all the google searches I have come accross always use date examples which also doesnt help Link to comment https://forums.phpfreaks.com/topic/54467-stripping/#findComment-269419 Share on other sites More sharing options...
master82 Posted June 6, 2007 Author Share Posted June 6, 2007 Sorry, didnt see the code you added... thought it was just my original code lol Link to comment https://forums.phpfreaks.com/topic/54467-stripping/#findComment-269420 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.