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


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>

Thanks in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
marhk51Author Commented:
Worked great, thanks alot mate :-)
You're welcome!  
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.