View Single Post
  #3   Report Post  
Posted to microsoft.public.word.newusers
[email protected] tante.v@gmail.com is offline
external usenet poster
 
Posts: 3
Default Need help with Find and Replace using Regular Expressions

Wow...that works great, and it's a lot simpler than what I was doing.
Can you help me to understand what the syntax is saying, so I get a
better idea of how to use regex?

Is it:

search for lowercase (a to z) or uppercase (A-Z)...meaning some letter
precedes the St...?

And could you explain what \1st means?

Thanks a lot! This is going to make my work go much more quickly.


On Aug 19, 9:10*am, "Graham Mayor" wrote:
How about replace
([a-zA-Z])St
with
\1st
?

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org




wrote:
I'm trying to search for instances of "St" in the middle of a word
(uppercase S, lowercase t) so that I can use Find and Replace to
correct the casing (as in firSt, laSt). I've come up with the
following regular expression string which almost works:


[!()( )(")(')^13]St


It was necessary to add so many exclusions to prevent it from giving
me "St" at the beginning of a word or line, after initial quotes, etc.


So, this works well except that it highlights not just "St", but the
letter preceding it: "rSt", "aSt". This prevents me from using Find
and Replace to replace "St" with "st". I can't seem to get a wildcard
like
?st to work in the Replace box, so I'm stuck. What is it about my
regex string that says "return the letter preceding the string I'm
looking for too"?


Thanks in advance.- Hide quoted text -


- Show quoted text -