![]() |
|
#1
|
|||
|
|||
|
Greetings! I simply want to be able to use Regex within a VB script for Word.
Surely someone already has this script already written? No, I don't want to use Word's built-in Find & Replace function including its "Wildcards" feature. Code:
Sub LineCounter()
Dim regExp As Object
Set regExp = CreateObject("vbscript.regexp")
With regExp
.Pattern = "(^p^p)"
.Global = True
Selection.Text = .Replace(Selection.Text, "^p")
End With
End Sub
Help, please! |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Regex to find space after two-letter words at the of the line and replace
|
Bachelar | Word VBA | 3 | 05-29-2022 07:03 AM |
Using VB Regex feature, I tried to replace 'the' and 'this' with 'that' but got screwed
|
abdan | Word VBA | 3 | 01-18-2019 09:38 PM |
| In Find and Replace, can Word stop after each Replace? | wardw | Word | 1 | 06-08-2017 02:47 PM |
Convert RegEx to Word (Devanagari Font Find/Replace)
|
gasyoun | Word VBA | 9 | 04-12-2013 04:15 PM |
Bad view when using Find and Find & Replace - Word places found string on top line
|
paulkaye | Word | 4 | 12-06-2011 11:05 PM |