Copied below is some RegEx code that I have found on Internet. Certain RegEx related search patterns that begin with .Text and likewise their .Replacement.Text usage could not be properly understood by me. Is there anyone who could explain these bunch of RegEx related lines of code to me for my understanding.
Also advise on the use of .Execute Replace with two variants wdReplaceOne and wdReplaceAll which even though sound self explanatory in Word but in VBA, these also need clarification as far as their used is concerned.
Your help would be much appreciated. Here is the code:
Sub StatementReformat()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
'First Page
.Text = "REPORT*EXTRACT FILE : [A-Z0-9]{1,}^13^12"
.Replacement.Text = ""
.Execute Replace:=wdReplaceOne
'Column Headers (except New First Page)
.Text = "^12*VEND^13*[-]{1,}^13"
.Execute Replace:=wdReplaceAll
'Header Underline on First Page
.Text = "[-]{1,}^13"
.Execute Replace:=wdReplaceAll
'Last Page
.Text = " TOTAL #*^12REPORT*{1,255}PAGE*{1,255}FUND TOTALS*[=]{1,}*^13*^13"
.Execute Replace:=wdReplaceAll
'Unwanted Header Lines - First Page
.Text = "REPORT*CHECK^13"
.Execute Replace:=wdReplaceAll
'Empty Paragraphs
.Text = "[ ]{1,}^13"
.Execute Replace:=wdReplaceAll
'Header Line Wrap - First Page
.Text = "(STATUS)^13"
.Replacement.Text = "\1"
'Record Line Wraps
.Execute Replace:=wdReplaceAll
.Text = "(OUTSTANDING)^13"
.Execute Replace:=wdReplaceAll
.Text = "(CLEARED)^13"
.Replaceme`enter code here`nt.Text = "\1 "
.Execute Replace:=wdReplaceAll
.Text = "(VOIDED)^13"
.Replacement.Text = "\1 "
.Execute Replace:=wdReplaceAll
'Pad Records with Multiple Rows
'Pad Records with Multiple Rows
.Text = "(^13)([ ]{20})([ ]{1,8}[0-9]{1,8}.[0-9]{2})"
.Replacement.Text = "\1\2\2\2\2\2\2\2 \3"
.Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub