I'm validating a text with this function in my PHP application:
public function alpha_special($str)
{
return ( ! preg_match("/^([-a-zA-Z0-9_-ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöùúûüýøþÿÐdŒ!?¿¡()\".',:@\n\r ]){0,350}+$/i", $str)) ? FALSE : TRUE;
}
It's a description field for a product, thus some characters apart alphanumerics should be allowed, also spaces, enter key line break, and with a limit of 350 characters.
Everything works fine unless I try to input a text with a lot of blank spaces and line breaks. If I do so, I get a windows error saying that Apache HTTP Server has stopped working (I'm running it on XAMPP).
However, if I either delete \n or \r of the regex it does not crash, but then it doesn't allow line breaks.
What I'm doing wrong here?
Thanks.