• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

Where can i find a IsAlphaNumeric UDF in ColdFusion

I am looking for a function in CFScript that can check whether or not a string is alphanumeric or not.  Could anyone help me?
0
onaled777
Asked:
onaled777
1 Solution
 
_agx_Commented:
You can use a regular expression like:

      <cfset foundAt = reFind("[^0-9a-zA-z]", string)>
       ... OR
       <cfset foundAt = reFind("[\W]", string)>  


Example
<cfset string = "!absdfsdfsdfsdfsdf3213">
<cfset foundAt = reFind("[^0-9a-zA-z]", string)>
<cfif foundAt eq 0>
	AlphaNumeric
<cfelse>
	Non-AlphaNumeric characters detected
</cfif>

Open in new window

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now