|
First, I like Charlie's function, its simple and it looks like it
would work well. However, if you are looking for alternatives, you can always use a regular _expression_. <cfif REFindNoCase("(badterm1|badterm2|badterm3)",cgi.http_user_agent) IS NOT 0> There is plenty of information on regular expressions all over the web if you want to be more creative, but essentially, you can put all your choices in one set of enclosing parens with a "|" as an OR separator. You can use "^" or "$" to only check at the begining or end of a string. For example we can do this... <cfset variables.regexpstring = '(badterm1$|^badterm2|badterm3|^badterm4$)'> <cfif REFindNoCase(variables.regexpstring,cgi.http_user_agent) IS NOT 0> This will find badterm3 anywhere within the string, badterm2 only when it starts the string, badterm1 only when it ends the string, and badterm4 only when it is the entire string. This is only the tip of the iceberg, there are many, many more options for regular expressions. Once you start using them, you will wonder how you managed without them. In addition, regular expressions can be used in _javascript_, Oracle, MySQL, perl, and the majority of modern programming languages. On 08/25/2011 09:22 AM, Clint Willard wrote: ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- |
- Re: [ACFUG Discuss] Best way t... Clint Willard
- Re: [ACFUG Discuss] Best way t... Steve Ross
- RE: [ACFUG Discuss] Best way t... Charlie Arehart
- RE: [ACFUG Discuss] Best way t... Charlie Arehart
- RE: [ACFUG Discuss] Best way t... Charlie Arehart
- RE: [ACFUG Discuss] Best way t... Szwedo . Ed
- RE: [ACFUG Discuss] Best way t... Charlie Arehart
- Re: [ACFUG Discuss] Best way to handle chunk of CFIF sta... Clint Willard
- Re: [ACFUG Discuss] Best way to handle chunk of CFI... Derrick Peavy
- Re: [ACFUG Discuss] Best way to handle chunk of... Mark Fennell
- Re: [ACFUG Discuss] Best way to handle chunk of CFI... Frank Moorman
- Re: [ACFUG Discuss] Best way to handle chunk of CFI... Cameron Childress
- Re: [ACFUG Discuss] Best way to handle chunk of... Mark Fennell
- Re: [ACFUG Discuss] Best way to handle chun... Cameron Childress
- Re: [ACFUG Discuss] Best way to handle ... Cameron Childress
- RE: [ACFUG Discuss] Best way to handle chunk of CFI... Charlie Arehart
- RE: [ACFUG Discuss] Best way to handle chunk of CFIF sta... Fennell, Mark P.
