Re: ereg

From: Date: Thu, 17 Apr 2003 14:42:20 +0000
Subject: Re: ereg
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-144289@lists.php.net to get a copy of this message
This is what I have: if(!ereg("^[a-zA-Z[:space:]\\']*$", $formdata["lastname"])) { $error = "Invalid Input"; } $formdata["lastname"] is a session variable and can't be changed as it is used throughout the site. I don't understand though why it it even being changed as I thought ereg was just an expression. Is there a better way to do this? TIA C.R. ----- Original Message ----- From: "Jason k Larson" <jlarson@candlefire.org> To: "C.R." <odcs@rogers.com> Cc: "PHP General" <php-general@lists.php.net> Sent: Wednesday, April 16, 2003 11:31 PM Subject: Re: [PHP] ereg > What about simply: > > $name = "O'Tool"; > ereg ('^[[:alpha:][:space:]\']*$', $name, $regs); > print_r ($regs); > > -- > der Ritter > aka: Jason k Larson > > > C.R. wrote: > > I'm trying to validate a persons name using ereg("^[a-zA-Z[:space:]\\']*$", > > $name]). This would allow all alpha characters, spaces, and an apostophe. > > The problem I am having is that the output of $name shows something like > > O\'Tool, instead of O'Tool. How do I get rid of the slash. Stripslashes > > does not work, but I don't think using this is appropriate in this situation > > anyway. > > > > Thanks > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#144289) next »