Wild Card Problem (Word 2007)
Greetings,
I am having trouble with "^13" in a wild card macro with which I am working.
I am applying the macro to search through text that has - scattered throughout - collections of numbers that are separated by two dashes, e.g., "4-5-708". These patterns in the text are not identical; in other words, within a single record, I may find "55-1-1" as well as "55-11-111", as well as "5-1-111", and so on.
I am interested in highlighting each collection of numbers, if any, that begins a paragraph of text.
Here is a brief snippet from the macro that is supposed to look for, e.g., "4-5-201" at the beginning of a text paragraph, highlight it, and add bold font to it:
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Bold = True
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "^13[0-9]-[0-9]-[0-9]{2,3}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
My difficulty is that the foregoing does not work; it should, but it does not. I believe the culprit is "^13", but I am unable to find a working equivalent or work-around.
When I search the record for "[0-9]-[0-9]-[0-9]{2,3}", I get results, but this search is not confined only to patterns that lead a paragraph of the content.
When I wild-card-search the record for "^13", I also get results; indeed, Word appears to land upon the hard returns that precede the number patterns of interest.
When I make use of "^p" and a literal number that I know is in the text (e.g., "4-5-790"), I also get results.
When, however, I undertake to use "^13[0-9]-[0-9]-[0-9]{2,3}", Word finds nothing in the record. That is odd to me, but perhaps I am missing something.
I appreciate your attention and hope you may have suggestions.
Regards,
q.
|