RE: [PHP] Allowing punctuation marks in regular expressions

2003-06-06 Thread John W. Holmes
> I tried adding a period to the end but a string will a period still
> returns
> false
> 
> function is_alphanumeric($string)
> {
>   return (preg_match("/^[A-Za-z0-9.]+$/i", $string));
> }

No it doesn't. It's not allowing spaces, though... Is that the problem?

---John W. Holmes...

Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Allowing punctuation marks in regular expressions

2003-06-06 Thread Leif K-Brooks
It's using the case-insensitive switch.

Dan Joseph wrote:

Also, if you want upper case letters, make sure you add A-Z:


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Allowing punctuation marks in regular expressions

2003-06-06 Thread Luis Lebron
I tried adding a period to the end but a string will a period still returns
false

function is_alphanumeric($string) 
{
return (preg_match("/^[A-Za-z0-9.]+$/i", $string));
}


-Original Message-
From: Dan Joseph [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 2:42 PM
To: Php-General (E-mail)
Subject: RE: [PHP] Allowing punctuation marks in regular expressions


Hi,

>   return (preg_match("/^[a-z0-9]+$/i", $string));

That a-z0-9 is where you can do it.  Just add ! or . or ? to the
end:

a-z0-9!?.

Also, if you want upper case letters, make sure you add A-Z:

A-Za-z0-9!?.

-Dan Joseph

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Allowing punctuation marks in regular expressions

2003-06-06 Thread Dan Joseph
Hi,

>   return (preg_match("/^[a-z0-9]+$/i", $string));

That a-z0-9 is where you can do it.  Just add ! or . or ? to the end:

a-z0-9!?.

Also, if you want upper case letters, make sure you add A-Z:

A-Za-z0-9!?.

-Dan Joseph

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php