LoginSignup
2
3

More than 5 years have passed since last update.

VBS: 正規表現の使い方メモ

Last updated at Posted at 2015-03-08

キャプチャの仕方を忘れる


' 普通の使い方
dim re, mc
set re = createObject("VBScript.RegExp")
re.pattern = "a(.)c"
set mc = re.execute("abc")

if mc.count > 0 then ' マッチしているか確認すること
    msgbox mc.item(0) ' "abc"
end if

' キャプチャ
dim submc
set submc = mc.item(0).submatches
msgbox submc.item(0) ' "b"


' その他フラグなど
re.ignoreCase = true ' 大文字小文字を区別しない
re.global = true ' 複数マッチ
re.multiline

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3