Regular expressions are often used to find word boundaries. Something like:
rereplacenocase('abc inc, DEF INC., XYZ Inc.', ' inc\.?,', ' Inc.,', 'all');
would replace all instances of the letters inc preceded by a space and
followed by an optional period and a comma with a properly capitalized
version preceded by a space and followed by a period and a comma.
Of course, the more typos you allow for, the more complicated this is going
to get.
You could also probably do something like parse the string as a space
delimited list and look at each element with whatever tools or whatever you
wanted.
As always, the plug for the CF-RegEx list:
http://www.houseoffusion.com/cf_lists/index.cfm?method=threads&forumid=21
:-)
--Ben Doom
Programmer & General Lackey
Moonbow Software
: -----Original Message-----
: From: James Johnson [mailto:[EMAIL PROTECTED]]
: Sent: Tuesday, October 15, 2002 8:16 PM
: To: CF-Talk
: Subject: Searching a string for whole word
:
:
: Hi,
:
: I'm trying to standardize my data and the company names may have XYZ
: Inc. or XYZ, Inc. or XYZ Inc (.) I'm looking for a way to search a
: string for a whole word, in order to replace it, similar to doing a
: Find/Replace in Word where you can search for the whole word. If I
: write:
:
: <cfset Variables.NewVendor = replace(Variables.NewVendor, "Inc",
: "Inc.")>
:
: it replaces all occurrences of the string "Inc" regardless of whether or
: not it has the ending period. So in other words if the Vendors name is
: malformed, such as, "XYZ Inc" I want to change it to "XYZ, Inc."
:
: Suggestions? TIA,
:
: James
:
: *******************************************
: James Johnson
: SMB-Studios
: Innovative Online Learning for Spirit, Mind and Body
: www.smb-studios.com
: [EMAIL PROTECTED]
:
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm