掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
RegExp・正規表現で、パターンの一部分を取得するには? (ID:80398)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Matchesコレクションや、SubMatchesコレクションについて調べてみてください。 冗長的に書くなら、こんな感じ。 Set objRegExp = CreateObject("VBScript.RegExp") objRegExp.Pattern = "(\d+):(\d+):(\d+)" Set objMatches = objRegExp.Execute("12:34:56") If objMatches.Count > 0 Then Set M = objMatches(0) If M.SubMatches.Count >= 3 Then MsgBox M.SubMatches(0) MsgBox M.SubMatches(1) MsgBox M.SubMatches(2) End If End If
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.