RE: [PHP-DB] problem with regular expression

2001-07-16 Thread Thomas

Why not simply : [a-zA-Z0-9]+ that would match any sequence of letters or
numbers ?

- Mensaje original -
De: Jennifer Arcino Demeterio [EMAIL PROTECTED]
Para: [EMAIL PROTECTED]
Enviado: lundi 16 juillet 2001 04:35
Asunto: [PHP-DB] problem with regular expression


i have a script to identify if the input is a combination of letters and
numbers

if (eregi([a-zA-Z0-9][0-9]+[a-zA-Z][0-9a-zA-Z],$fieldvalue))
print alphanumeric
} else {
not an alphanumeric
}

my problem is, when the string ends with a number, for example hello123, it
says not an alpanumeric ... it works fine when the number is placed before
the letters or in between letters ... why is that?

i would really appreciate your help, thanks very much

:)



-- 
PHP Database 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]




Re: [PHP-DB] problem with regular expression

2001-07-16 Thread billt

On Mon, Jul 16, 2001 at 10:41:15AM -0300, Thomas wrote:
 - Mensaje original -
 De: Jennifer Arcino Demeterio [EMAIL PROTECTED]
 Para: [EMAIL PROTECTED]
 Enviado: lundi 16 juillet 2001 04:35
 Asunto: [PHP-DB] problem with regular expression
 
 i have a script to identify if the input is a combination of letters and
 numbers
 
 if (eregi([a-zA-Z0-9][0-9]+[a-zA-Z][0-9a-zA-Z],$fieldvalue))
 print alphanumeric
 } else {
 not an alphanumeric
 }
 
 my problem is, when the string ends with a number, for example hello123, it
 says not an alpanumeric ... it works fine when the number is placed before
 the letters or in between letters ... why is that?

the regular expression you have says:

 match any letter or number, followed by one or more numbers followed
by any letter followed by any letter or number.

hello123 fails on the 'e' (not being a number).

Something like H12345 would fail because there is no letter after the
5.

Cheers,
Bill


 
 i would really appreciate your help, thanks very much
 
 :)
 
 = sigkiller was here (PHP)
 

-- 
PHP Database 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]