Regex *is* the key then.  Many thanks.

-Nate

-----Original Message-----
From: Jason Fisher [mailto:[email protected]] 
Sent: Wednesday, August 17, 2011 4:48 PM
To: cf-talk
Subject: Re: matching a whole word


Yes, indeed.  You want something like this:

keyword = "star";
myString = "The dog sniffed at the starfish and growled"; regEx = "\b" & 
keyword & "\b"; if (reFindNoCase(regEx, myString)) {
     writeOutput("found it");
} else {
     writeOutput("did not find it");
}

On 8/17/2011 5:20 PM, Nathan C. Smith wrote:
> If I want to scan a string to match only a whole word should I be 
> looking at regular expressions?  I want to scan a string like
>
> "The dog sniffed at the starfish and growled"
>
> And if I scan for "star" not match "starfish".
>
> Are regular expressions the most effective way to do that?
>
> Thank you.
>
> -Nate
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346821
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to