Re: 請問這是VB 6.0的語法嗎?

看板Programming作者時間18年前 (2006/11/15 14:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
※ 引述《BoHann.bbs@bbs.cis.nctu.edu.tw (延宕的人生)》之銘言: > 其中Dim r As Regex = new Regex(pat, RegexOptions.IgnoreCase) 這一行在VB6的syntax應該是 Dim r As Regex Set r = New new Regex(pat, RegexOptions.IgnoreCase) 不過前提是你的VB6需要有Regex object可以使用... :P 在VB6中要用RegEx需要reference "Microsoft VBScript Regular Expressions 5.5" 語法如下... 'Prepare a regular expression object Dim myRegExp As RegExp Dim myMatches As MatchCollection Dim myMatch As Match Set myRegExp = New RegExp myRegExp.IgnoreCase = True myRegExp.Global = True myRegExp.Pattern = "regex" Set myMatches = myRegExp.Execute(subjectString) For Each myMatch in myMatches MsgBox(myMatch.Value) Next -- ※ Origin: SayYA 資訊站 <bbs.sayya.org> ◆ From: static-ip-84-126-134-202.rev.dyxnet.com
文章代碼(AID): #15MgqX00 (Programming)
文章代碼(AID): #15MgqX00 (Programming)