> 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to