[thelist] [regexp] I'm lost

Paul Bennett paul at teltest.com
Thu Jul 17 22:29:06 CDT 2003


Paul Cowan wrote:

>
> Paul Bennett wrote:
>
>> am I even close? (Results attest otherwise)
>
>
> Something like this should work:
>     ^[_a-zA-Z0-9 ()\-]+$
> You may or may not need to escape the parentheses -- replace () with
> \(\) -- depending on the regexp engine that PHP uses.
>
> Hope this helps, 

Thanks Paul after a bit of fudging, the following function seems to be 
working (I have to allow '$' as the company we are developing for 
insists on having text and dollar amounts in their 'fees' component)

# now check for alpha, numeric, spaces, hyphens, dollar signs, 
underscores and brackets
        if(eregi('^[_\.\,a-zA-Z0-9 ()$-]+$', $value))
            {$response["alphaNumSpecial"] = true;}
        else
            {$response["alphaNumSpecial"] = false;}
 


-- 
 ------------------------------
	Paul Bennett						
	Internet Developer				
	Teltest Electronic Design		
 ------------------------------			
Email: paul at teltest.com				
Phone: 64 4 237 4557					
Web: http://www.teltest.com		
Wap: http://wap.teltest.com			




More information about the thelist mailing list