I've set up some capitalization Replace rules using the 'whole word' option. When that word is bracketed by other than spaces, the action doesn't get executed. For example, my rule replaces the word uk to UK. But the string '(uk uk uk)' ends up as '(Uk UK Uk)'. Is this the expected result? Do I need to change all replaces to regular expressions in order to get the right result? I would not expect symbols to be part of words.
I am currently using
Replace with: UK
and checking the 'only as a word' box.
Last night I was thinking maybe something like this in a regular expression replace might be better:
[your \U$0 gets the same results. Does it mean uppercase the entire string?]
That way I can put all things to uppercase in one place. Well, I just tried this, and it kind of works, but not totally. I'm using a test string Of:
uk (usa nyc mtv) ( uk) nyc usa (uk uk uk) uk
The result is:
UK (USA nyc MTV) ( UK) NYC usa (UK uk UK) UK
Any thoughts on why some strings bracketed by spaces don't get uppercased?
Thanks for your help.
(update: I see why it doesn't work, the leading space for the failures is used up by the previous match. Is there a fix for this? A symbol perhaps that works like ^ but for the start of the next match-search?)
$replace($regexp($replace(%TJWHALE%,'',''),'(^|\(| )(uk|mtv|nyc|usa)( |\)|$)','\U$0'),'','')$regexp($regexp(''%TJWHALE%'','(?<=[\( ])(uk|mtv|nyc|usa)[ \)]','\U$0'),' (.+) ','$1')$regexp(%TJWHALE%,'(^|(?<=[\( ]))(uk|mtv|nyc|usa)([ \)]|$)','\U$0')$trim($replace($replace($replace(''%TJWHALE%'','','','(','( ',')',' )'),' uk ',' UK ',' mtv ',' MTV ',' nyc ',' NYC ',' usa ',' USA '),'( ','(',' )',')','',''))
"xnyc uk (usa nyc mtv) ( uk) nyc usa (uk uk uk) uk gnuk uk"
"xnyc UK (USA NYC MTV) ( UK) NYC USA (UK UK UK) UK gnuk UK"
I don't want to beat this to death, but I'm still trying to figure out the expected behavior of the 'whole word' check box in the Replace action. Is it a deficiency or desired result that a string of characters is considered a word only if it's bracketed by spaces, beginning of string, or end of string? If expected, it would seem to be of limited usefulness.