<CFIF REFind('[^A-Za-z-]',form.fieldname)>
        <CFSET errstr="Has bad characters!">
</CFIF>

Mark

-----Original Message-----
From: Ryan [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 01, 2000 4:30 PM
To: CF-Talk
Subject: best way to see if a var only has certain characters?


Simple question. On one of the fields of a form I need to make sure it
only contains 0-9, A-Z and -. Whats the best way to do this? I could
do it in 30 seconds in perl but am not sure of the best way in CF. The
way I did it when I was first starting CF was like this:

<CFSET
basespan="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789">
<CFIF SpanIncluding(Form.fieldname, basespan) NEQ  Form.fieldname>
  <CFSET errstr="Has bad characters!">
</CFIF>

But there might be a better way to do it?

Thank you!

Ryan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to