Re: ereg
| From: | (Chris Adams) | Date: | Sun, 01 Apr 2001 05:47:29 +0000 |
| Subject: | Re: ereg | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46495@lists.php.net to get a copy of this message | ||
On 31 Mar 2001 21:07:59 -0800, Michael Hall <lists@mulga.com.au> wrote:
>
>I'm using the following expression to check input strings:
>
>if (!ereg("^[[:alnum:]_-]+$", $string)) { get outta here! }
>
>This works fine except for when a string has spaces, as in text. What do I
>need to add to the expression to handle spaces (internal, not at the
>beginning or end).
if (!ereg("^[[:alnum:]_- ]+$", $string)) { get outta here! }
Check out the regular expression documentation or "Mastering Regular
Expressions" over at ora.com.