On 31 Mar 2001 21:07:59 -0800, Michael Hall <[EMAIL PROTECTED]> 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to