Solved

Find function

Posted on 2014-11-04
3
89 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

829 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