Guest User

Untitled

a guest
Jul 15th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.68 KB | None | 0 0
  1. Sub test()
  2.    
  3.     Dim rExp As Object, TheMatches As Object, MyStr
  4.     MyStr = ActiveDocument.Range.Text
  5.    
  6.     Set rExp = CreateObject("VBScript.RegExp")
  7.    
  8.     With rExp
  9.         .Pattern = "^([^\n]*?)(- )$"
  10.  
  11.         .IgnoreCase = True
  12.         .Global = True
  13.         .MultiLine = True
  14.         Set TheMatches = .Execute(MyStr)                'Just to check
  15.         MyStr = .Replace(MyStr, "START$2$1END")
  16.        
  17.     End With
  18.    
  19.     Debug.Print (MyStr)                         'check the debug for the results
  20.  
  21. End Sub
  22.  
  23. 'sample text, put the following 3 lines in an empty document
  24.  
  25. '00:03:43,146 --> 00:03:47,413
  26. 'Where?-                    'this is supposed to become "-Where?"
  27. 'At home.-                  "-At home."
Add Comment
Please, Sign In to add comment