Regular Expression

From: Date: Tue, 13 Nov 2001 07:11:12 +0000
Subject: Regular Expression
Groups: php.general 
Request: Send a blank email to php-general+get-74379@lists.php.net to get a copy of this message
Hi All- This is probably very simple for most of you. I have the following statement if ((ereg("[^[:alnum:]]",$fn)) || (ereg("[^[:alnum:]]",$sn))) { // Do something here } What it's doing is checking two variables to make sure they contain only alphanumeric characters. I have a requirement that hyphens (-) be allowed in $fn and $sn as well. What do I need to add to the regular expression to allow hyphens? I know this is a relatively silly question. I plan on buying a book on regular expressions today and learning as much as I need to know about building them. Cheers. Regards, Adam Whitehead Systems Developer - Computer Support and Maintenance Ph. (08) 8936 3164 ** Mobile (0411) 241 120 E-mail: adam.whitehead@compsm.com.au

« previous php.general (#74379) next »