Solved

Find function

Posted on 2014-11-04
3
91 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
[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 36

Expert Comment

by:SidFishes
ID: 40422866
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
ID: 40422969
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
ID: 40423044
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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

756 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