Re: Apostrophe in preg_match?

From: Date: Wed, 28 Aug 2002 10:16:46 +0000
Subject: Re: Apostrophe in preg_match?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-114341@lists.php.net to get a copy of this message
> I'm trying to get an apostrophe (and a dash, as well) to be > included in a preg_match expression, but I don't know how to escape the > characters. The manual discusses which characters need escaping and how to escape characters: http://www.php.net/manual/en/pcre.pattern.syntax.php > <?php > if (preg_match("^[!a-zA-Z-/\\\'/]^", $_POST['ssname'])) die > ("<h5>Numbers and special characters not allowed in > 'Surname'<br><br> > Click 'Back' on your browser to re-enter > information.</h5>"); > > ?> > Any help will be greatly appreciated. Keep it simple: [^a-zA-Z-'] Regards, =dn

« previous php.general (#114341) next »