?
Solved

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

Posted on 2003-03-14
3
Medium Priority
?
206 Views
Last Modified: 2013-12-24
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
Comment
Question by:marhk51
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
JimV_ATL earned 200 total points
ID: 8138418
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
 

Author Comment

by:marhk51
ID: 8138489
Worked great, thanks alot mate :-)
0
 
LVL 5

Expert Comment

by:JimV_ATL
ID: 8138511
You're welcome!  
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question