Case preservation in replace

  • Thread starter Thread starter tedmi
  • Start date Start date
T

tedmi

If I replace "a" with "q" (not that I really would want to do that), the case
of the replacement q matches the case of the found a.
But here's a real-world example: .
But if I replace " a " (note spaces before and after) with " a^s", (to avoid
a single-letter word at the end of a line) the replacement is always
lowercase, even if the found A is upper.
"Match case" option is turned off in both replacements.
Why is this?
 
Match case applies to the find string, not the replace string. With match
case turned on, finding a will not find A.
 
Thanks, Graham, I'm familar with the use of wildcards. My question was not
how to do it, but what are the rules for preserving the case of replaced
text. I'm still not clear on that one.
In playing with this, I discovered another difference in wildcard searches:
With wildcards off, finding space finds both normal and non-breaking spaces.
With wildcards on, normal and non-breaking spaces are treated as distinct.
(Word 2002 and 2007)
Anyway, my purpose is to prevent single-letter words (which can occur at the
beginning of or within sentences) from hanging at the end of lines - a
typographic princicple in many foreign languages. It gets even more fun for
languages (such as many Slavonic ones) which have the possibility of TWO
single-letter words in a row!
 
Have you set the language of a document to one of those languages to
see whether it's taken care of? After all, Word does quotation marks
and punctuation differently according to the language, even when
typing on an ordinary US English keyboard, so if the standard style
guide for Polish or Czech or whatever contains that rule about one-
letter words, it should be included in the language setting..

Thanks, Graham, I'm familar with the use of wildcards. My question was not
how to do it, but what are the rules for preserving the case of replaced
text. I'm still not clear on that one.
In playing with this, I discovered another difference in wildcard searches:
With wildcards off, finding space finds both normal and non-breaking spaces.
With wildcards on, normal and non-breaking spaces are treated as distinct.
(Word 2002 and 2007)
Anyway, my purpose is to prevent single-letter words (which can occur at the
beginning of or within sentences) from hanging at the end of lines - a
typographic princicple in many foreign languages. It gets even more fun for
languages (such as many Slavonic ones) which have the possibility of TWO
single-letter words in a row!
--
TedMi

Graham Mayor said:
Set the wildcard option and search for [Aa] instead add round brackets
([Aa])
and replace with \1
Seehttp://www.gmayor.com/replace_using_wildcards.htm
My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top