networkthis Posted May 11, 2008 Share Posted May 11, 2008 I have the following to allow only certain characters in a form field, it is for a text input box. It works great unless you hit enter to add a new line. How would I make this register hitting enter as well - I thought it was /n but I tried that and it did not work. function Validate_Message_Characters($message){ if (preg_match("/[^a-zA-Z.!,'0-9[:blank:]]/",$message)) { return false; } else { return true; } } thanks in advance for your help! Link to comment https://forums.phpfreaks.com/topic/105101-solved-preg_match-question/ Share on other sites More sharing options...
networkthis Posted May 11, 2008 Author Share Posted May 11, 2008 Ok I figured it out, I needed a carriage return to be allowed instead. \r Link to comment https://forums.phpfreaks.com/topic/105101-solved-preg_match-question/#findComment-538061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.