RE: [PHP] newbie: regular expression suggestios

2002-01-31 Thread Rick Emery

try:   if (eregi(^[a-zA-Z0-9]*$, $name))

This searches for [a-zA-Z0-9] between start and end of line with no other
intervening characters

-Original Message-
From: Lee P Reilly [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 1:45 PM
To: PHP List
Subject: [PHP] newbie: regular expression suggestios


Hi,

I am using (getting to grips with) regular expressions for validating
form data and have come across a little problem:

I have a statement like the following:
if (eregi(^[a-z0-9]{strlen($name)}$, $name))
{
   blah...
   return true;
}

, but the strlen($name) does not seem to evaluated. Is there any way
this can be accomplished? If the code above is not clear (or correct!),
I am returning true iff the input is comprised of chars
(letters/numbers) only. Maybe there's a better/more efficient way to
accomplish this..?

Any information greatly aprpeciated. Thanks in advance!

  - Best regards,
  Lee Reilly

--
Lee P. Reilly,  ms:G758
Szilard Resource,  tel:505-665-7025
Bioscience Division,
SM-30 Bikini Atoll Rd,
Los Alamos National Laboratory, mailto:[EMAIL PROTECTED]
Los Alamos, NM 87545.  http://home.lanl.gov/lreilly

  Quidquid latine dictum sit, altum viditur




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

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




RE: [PHP] newbie: regular expression suggestios

2002-01-31 Thread Rick Emery

I thought about the case insensitivity, but I wanted to be certain that A-Z
was captured.  Personnally, I'd use ereg(), as you suggest.

-Original Message-
From: Administrator [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 2:38 PM
To: Rick Emery
Subject: Re: [PHP] newbie: regular expression suggestios


Would I be mistaken to say that the A-Z is not needed when using eregi() ?

ereg(^[a-zA-Z0-9]*$);
or
eregi(^[a-z0-9]*$);

eregi() being case insensitive...

Am I wrong?


- Original Message - 
From: Rick Emery [EMAIL PROTECTED]
To: 'Lee P Reilly' [EMAIL PROTECTED]; PHP List
[EMAIL PROTECTED]
Sent: Thursday, January 31, 2002 2:27 PM
Subject: RE: [PHP] newbie: regular expression suggestios


 try:   if (eregi(^[a-zA-Z0-9]*$, $name))
 
 This searches for [a-zA-Z0-9] between start and end of line with no other
 intervening characters
 
 -Original Message-
 From: Lee P Reilly [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 31, 2002 1:45 PM
 To: PHP List
 Subject: [PHP] newbie: regular expression suggestios
 
 
 Hi,
 
 I am using (getting to grips with) regular expressions for validating
 form data and have come across a little problem:
 
 I have a statement like the following:
 if (eregi(^[a-z0-9]{strlen($name)}$, $name))
 {
blah...
return true;
 }
 
 , but the strlen($name) does not seem to evaluated. Is there any way
 this can be accomplished? If the code above is not clear (or correct!),
 I am returning true iff the input is comprised of chars
 (letters/numbers) only. Maybe there's a better/more efficient way to
 accomplish this..?
 
 Any information greatly aprpeciated. Thanks in advance!
 
   - Best regards,
   Lee Reilly
 
 --
 Lee P. Reilly,  ms:G758
 Szilard Resource,  tel:505-665-7025
 Bioscience Division,
 SM-30 Bikini Atoll Rd,
 Los Alamos National Laboratory, mailto:[EMAIL PROTECTED]
 Los Alamos, NM 87545.  http://home.lanl.gov/lreilly
 
   Quidquid latine dictum sit, altum viditur
 
 
 
 
 -- 
 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]
 
 -- 
 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]
 

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