View Single Post
 
Old 01-24-2025, 06:49 PM
anniewong anniewong is offline Mac OS X Office 2021
Novice
 
Join Date: Jan 2025
Posts: 1
anniewong is on a distinguished road
Default How to Use Wildcards to Find Specific Text Patterns with sub-levels

How to Use Wildcards to Find Specific Text Patterns When Some Text is Part of the Text ?Any help would be appreciated
I have list of pattern to search the text , which is

Example Patterns:
1.1
1.1(a)
1.12
1.12(a)
1.12(b)

Example document to search:
1.1 1.12(a) 1.1(a) 1.12 1.12(a) 1.12(b) 1.1

Issues:
  • When I search with 1.1 first, it will match all 1.1(a) , 1.12 , 1.12(a) , 1.12(b) with wildcard search.
  • Using the wildcard pattern "Rule 1.1[!( ]" fails to match 1.1 if it appears at the end of a sentence..
  • Using the whole word match , it doesn't work because its number , not a word

I am using mac so can't use regular expression which just much more easier to do it .

PHP Code:
Selection.Find.ClearFormatting
    With Selection
.Find
        
.Text "Rule 1.1[!( ]"
        
.Forward True
        
.Wrap wdFindAsk
        
.Format False
        
.MatchCase False
        
.MatchWholeWord False
        
.MatchByte False
        
.MatchAllWordForms False
        
.MatchSoundsLike False
        
.MatchWildcards True
    End With
    
Do While Selection.Find.Execute
        Selection
.Range.HighlightColorIndex wdYellow
    Loop
End Sub 
Reply With Quote