D
dan
I'm trying to find any numbers in a document that look like: 1.3,
3.2.1, 5.1.2.3, etc or the text 'Article 10' and replace them with a
REF field that links to the correct paragraph. I've got the linking
code working great, but I'm having trouble getting either the built in
Find or the RegExp to work correctly.
I first tried using the regex pattern
(\d{1,}\.\d{1,}(\.\d{1,}){0,})|(Article.\d{1,}
That worked really well, but when I tried to loop through the matches
as soon as I replace a number with a field the next match would be in
the wrong position. I tried a
Do While RegEx.Execute(ActiveDocument.Range.Text) to insert the fields
as it went, ala Selection.Find.Execute(), but that just threw error
messages.
I just tried a wildcard search, but I can't seem to get that to work
correctly either.
[0-9]{1,2}.[0-9]{1,2} finds most of them, but has trouble with 3.2.1
Any thoughts out there?
3.2.1, 5.1.2.3, etc or the text 'Article 10' and replace them with a
REF field that links to the correct paragraph. I've got the linking
code working great, but I'm having trouble getting either the built in
Find or the RegExp to work correctly.
I first tried using the regex pattern
(\d{1,}\.\d{1,}(\.\d{1,}){0,})|(Article.\d{1,}
That worked really well, but when I tried to loop through the matches
as soon as I replace a number with a field the next match would be in
the wrong position. I tried a
Do While RegEx.Execute(ActiveDocument.Range.Text) to insert the fields
as it went, ala Selection.Find.Execute(), but that just threw error
messages.
I just tried a wildcard search, but I can't seem to get that to work
correctly either.
[0-9]{1,2}.[0-9]{1,2} finds most of them, but has trouble with 3.2.1
Any thoughts out there?