Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub test()
- Dim rExp As Object, TheMatches As Object, MyStr
- MyStr = ActiveDocument.Range.Text
- Set rExp = CreateObject("VBScript.RegExp")
- With rExp
- .Pattern = "^([^\n]*?)(- )$"
- .IgnoreCase = True
- .Global = True
- .MultiLine = True
- Set TheMatches = .Execute(MyStr) 'Just to check
- MyStr = .Replace(MyStr, "START$2$1END")
- End With
- Debug.Print (MyStr) 'check the debug for the results
- End Sub
- 'sample text, put the following 3 lines in an empty document
- '00:03:43,146 --> 00:03:47,413
- 'Where?- 'this is supposed to become "-Where?"
- 'At home.- "-At home."
Add Comment
Please, Sign In to add comment