Jump to content

[SOLVED] Preg_match question


networkthis

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.