RE: [PHP] Allowing punctuation marks in regular expressions

From: Date: Thu, 05 Jun 2003 19:57:40 +0000
Subject: RE: [PHP] Allowing punctuation marks in regular expressions
Groups: php.general 
Request: Send a blank email to php-general+get-150399@lists.php.net to get a copy of this message
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:djoseph@duhq.us] 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

« previous php.general (#150399) next »