webdev007
Programmer
- Sep 9, 2005
- 168
The input from a text area form is:
$experience=nl2br($_POST['experience']);
Then I have a class with a few functions that check for a lot of possible hacks from injection to bad words etc..
My problem is that with or without nl2br() my regex is always rejecting the form input.
BUT if I use only one line and indeed do not type "enter" then all goes well
I think the way I wrote my regex is wrong (I am deficient with reg expressions)
I try to allow for 0 or any recurring occurrences of the result of nl2br which is <br />by using the following function:
function PregLongText($any_text)
{
if (!preg_match("/^[a-zA-Z0-9 ]*[\<br \/\>]+$/",$this->any_text=$any_text) )
{
return(1);
else
{
return(0);
}
How could I make it working?
Thanks
$experience=nl2br($_POST['experience']);
Then I have a class with a few functions that check for a lot of possible hacks from injection to bad words etc..
My problem is that with or without nl2br() my regex is always rejecting the form input.
BUT if I use only one line and indeed do not type "enter" then all goes well
I think the way I wrote my regex is wrong (I am deficient with reg expressions)
I try to allow for 0 or any recurring occurrences of the result of nl2br which is <br />by using the following function:
function PregLongText($any_text)
{
if (!preg_match("/^[a-zA-Z0-9 ]*[\<br \/\>]+$/",$this->any_text=$any_text) )
{
return(1);
else
{
return(0);
}
How could I make it working?
Thanks