Skip to content

Instantly share code, notes, and snippets.

@pandanote-info
Created May 27, 2022 01:37
Show Gist options
  • Save pandanote-info/3816b4b043ebaadb2bd6f9353efee4da to your computer and use it in GitHub Desktop.
Save pandanote-info/3816b4b043ebaadb2bd6f9353efee4da to your computer and use it in GitHub Desktop.
正規表現を用いて文字列の置換を行うためのVBAのプログラム例
Sub regexp_test()
Dim reg As Object
Set reg = CreateObject("VBScript.RegExp")
reg.Global = True
reg.Pattern = "^([^\(]+)\(([^\)]+)\)"
Dim output As String
output = reg.Replace("京急1000形1890番台(Le Ciel)", "$2 $1")
Debug.Print output
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment