Log in

View Full Version : [SOLVED:] Find Lower-Case But Maintain Letter?



VB-AN-IZ
07-07-2016, 07:26 AM
I can find each paragraph that begins with a lower-case letter by searching for:


^13[a-z]

If modifying the surrounding character/s (removing the paragraph, for example), how do I maintain the original/existing lower-case letter? All my attempts so far have ended up with "[a-z]" within the text...

Basically I want to be able to turn this:


That was a.
great shot.

...into:


That was a great shot.

Thanks for any help!

Paul_Hossler
07-07-2016, 09:39 AM
Simple recorded macro with

1. .MatchWildcards = True

2. \. 'escapes' the end of sentence period since 'dot' can be a RegEx metacharacter

3. ^13 for the paragraph mark; ^10 if new line mark

4. 'Grouping' ( ) around the matching range a-z so that ...

5. ... the space+\1 in Replacement can refer to what was found in the first (only) grouping





Sub Macro3()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

With Selection.Find
.Text = "\.^13([a-z])"
.Replacement.Text = " \1"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

VB-AN-IZ
07-09-2016, 02:34 AM
Excellent. Thanks so much!