Solved

Find function

Posted on 2014-11-04
3
80 Views
Last Modified: 2014-11-05
I have a doc which I am searching which has both the string "CKR" and "CKR1", is there a way to only search for CKR and don't have it find a match via the CKR1 as well ? If not I might need to try to search for "CKR " since that would eliminate the CKR1 matches

Thanks
0
Comment
Question by:AlexPonnath
  • 2
3 Comments
 
LVL 36

Expert Comment

by:SidFishes
Comment Utility
You can use REFindNoCase and a word boundary regex

<cfset myCriteria = "ckr">

<cfset strToSearch = "ckr1 some stuff">

<cfif refindnocase("\b#myCriteria #\b", strToSearch )>
Found
<cfelse>
Not Found
</cfif>

Try with both
ckr some stuff
ckr1 some stuff
0
 

Author Comment

by:AlexPonnath
Comment Utility
that might work in some case but I am using something like this

<CFSET CKRSTART = #find("CKR ", form.text1,Curcuit)#>
<CFSET CKR1START = #find("CKR1 ", form.text1,Curcuit)#>

not sure if that will work in that case..
0
 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
Comment Utility
Mine obviously wasn't a plug & play solution. Just showing the concept.

In any case, should work just fine.

btw in most cases you don't need #'s within CF tags


<CFSET CKRSTART refindnocase("\bCKR\b", form.text1,Curcuit))>
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now