Re: 請問這是VB 6.0的語法嗎?
※ 引述《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
討論串 (同標題文章)
Programming 近期熱門文章
PTT數位生活區 即時熱門文章