problem with ereg and backslashes
Posted: Sun Oct 19, 2008 10:51 pm
I'm allowing users to send an email as an invitation. I pre-fill it (using \n for new line), let them edit it and check if after that. I always get a negative response in the ereg when including \ in the string, and I can't figure out how to fix it. Any suggestions?
Code: Select all
$invitationClean = "Hello.\n\nYou are invited.";
if( !ereg("^([A-Za-z0-9',. -!\\]{0,250})+$", $invitationClean) )
{ echo "invitationClean - bad data<br>"; }
else
{ echo "invitationClean - OK data<br>"; }