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 Quote 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 ?> Quote 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 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/54467-stripping/#findComment-269420 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.