Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

How do I do a NON case sensitve search in a string

Hi,

Please can somebody tell me how I can do a NON case sensitve search within a string ??

For example, a user enters their username as 55ADMIN66 or iamADMIN through a form, but they entered a word **within** their username which is not allowed i.e admin,swear words etc.

How do I compare a list of words i.e (NotAllowedUsernames = "admin,owner,moderator,master) to their username name string so I can display and error message.

This is what I've tried:

<CFIF IsDefined("Form.username")>
<CFIF FindNoCase("#notallowedusernames#","#username#") NEQ 0>
<CFSET usernameError = 1>
</CFIF>
</CFIF>

Thanks in advance.
Mark
0
marhk51
Asked:
marhk51
  • 2
1 Solution
 
JimV_ATLCommented:
You're using findnocase properly, the problem appears to be that you're putting a list of "notallowedusernames" for your substring.

Try this

<cfloop index="notallowedusernames_idx" list="#notallowedusernames#">
     <CFIF FindNoCase("#notallowedusernames_idx#","#username#") NEQ 0>
          <CFSET usernameError = 1>
     </cfif>
</cfloop>
0
 
marhk51Author Commented:
Worked great, thanks alot mate :-)
0
 
JimV_ATLCommented:
You're welcome!  
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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