VBAを使用して簡単なスクリプトを作成しました。(Excelでいくつかの作業を最適化する必要があります)。
正規表現に関する最初の質問:
前に言ったように、私はVBAを使用しました。
簡単なタスク:パターンの一致を取得し、サブ一致をキャプチャします。
私のコードは:
Dim ResStr as Object
Dim LastStr as Object
Dim RE as Object
Set RE = CreateObject("vbscript.regexp") 'create a regex
With RE
.MultiLine = False 'm-key
.Global = False 'g-key
.IgnoreCase = False 'i-key
.Pattern = "[<]TD\s+class=gm[>](\d+\.\d+)[<][/]TD[>]" 'tag
End With
Set ResStr = RE.Execute(StrDollar) 'use regex
Set LastStr = ResStr(0).SubMatches 'get submatch
LASTマッチとLASTサブマッチを取得するにはどうすればよいですか?(長さ-プロパティ?)
Dir関数に関する2番目の質問:
ファイルをフィルタリングするにはどうすればよいですか?
私はmsdnでこのコードを見ました:
' Display the names in C:\ that represent directories.
MyPath = "c:\" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
Do While MyName <> "" ' Start the loop.
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
' Display entry only if it's a directory.
Debug.WriteLine(MyName)
End If
MyName = Dir() ' Get next entry.
Loop
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
-'msdn-guy'を停止します!冗談ですか?それはただ一つの方法ですか?
この途方もないラインの方法ではなく、通常のフィルターを作成するための可能な方法はありますか?