Re: [Phplib-users] Invalid Regex
Brought to you by:
nhruby,
richardarcher
From: Matt W. <li...@ye...> - 2002-10-31 18:37:24
|
On Thursday 31 October 2002 18:32, Rob Hutton wrote: > I am trying to validate the username field, and just to make up some > arbitrary rules, it has to be between 6 and 25 characters long and have= no > punctuation. So my valid regex looks something like "[A-Za-z0-9]{6,}" = but > how do I tell it to fail if is has anything else? Like invalid_regex =3D > "[^A-Za-z0-9]"? Hi Rob to check for alphanumeric chars between 6 and 25 chars use "^[a-zA-Z0-9]{6,25}$" This will bail if it's not like that. You can drop A-Z bit depending on whether you're using ereg or eregi matt |