As far as the "ben ben" problem goes -- this is a problem I've run into
before.  Essentially, the space after the first ben is "used up" so it can't
be used to match the next "ben".  So you have to run the replace multiple
times.

By the way, I approve of your example names.  :-)

Anyhow, here's what I'd do to solve the benben problem as well as the
capitalization problem:  a loop.

something like...
refindnocase of first instance of oldname
while (there's an instance found)
        check the case of the instance
        replace with appropriately capped version of newname
        find next instance
end loop

If you're just worried about titlecase, you could use something like refind
on "^[A-Z]" to determine if the first letter is capital.  If you are also
worried about all cap, you could also test something like refind on "[a-z]"
to see if there are any lowercase.

HTH.  If you need more assistance, or this doesn't make sense, or you think
I'm a Crack Smoking Monkey for thinking this way, feel free to ask/vent at:
http://www.houseoffusion.com/cf_lists/index.cfm?method=threads&forumid=21
The HOFREGEX list.  For all your abbreviation (and RE) needs.


--  Ben Doom
    Programmer & General Lackey
    Moonbow Software, Inc

: -----Original Message-----
: From: Jim Banks [mailto:[EMAIL PROTECTED]
: Sent: Wednesday, June 04, 2003 10:54 AM
: To: CF-Talk
: Subject: Re: Regex replacing whole words
:
:
: That's great Jerry! Thanks! That does most of what I need. I
: think the majority of the 'case' problems will just be where the
: first letter is capitalised.
:
: One thing I've noticed though is that if you have 'ben ben' it
: only replaces the first 'ben' with 'mike'. So it becomes 'mike ben'.
:
: Weird.
:
: But thanks for the efforts, that's cool!
:
:
:
:
: ---------------------------------
: Yahoo! Plus - For a better Internet experience
:
: 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to