Re: 請問這是VB 6.0的語法嗎?
It's VB.NET....
not VB6
※ 引述《BoHann.bbs@bbs.cis.nctu.edu.tw (延宕的人生)》之銘言:
: 請問各位先進
: 我想要用VB來寫有關Regular Expression的處理
: 結果找到如下程式碼:
: 看起來滿像是VB的,但是放在VB6.0當中,第一行Dim就紅字了
: 其中Dim r As Regex = new Regex(pat, RegexOptions.IgnoreCase)
: 也有問題,所以想請問我找到的語法是for VB的嗎?
: 另外,能否提供一下VB關於Regular Expression的範例
: Dim text As String = "One car red car blue car"
: Dim pat As String = "(\w+)\s+(car)"
: ' Compile the regular expression.
: Dim r As Regex = new Regex(pat, RegexOptions.IgnoreCase)
: ' Match the regular expression pattern against a text string.
: Dim m As Match = r.Match(text)
: Dim matchcount as Integer = 0
: While (m.Success)
: matchCount += 1
: Console.WriteLine("Match" & (matchCount))
: Dim i As Integer
: For i = 1 to 2
: Dim g as Group = m.Groups(i)
: Console.WriteLine("Group" & i & "='" & g.ToString() & "'")
: Dim cc As CaptureCollection = g.Captures
: Dim j As Integer
: For j = 0 to cc.Count - 1
: Dim c As Capture = cc(j)
: Console.WriteLine("Capture" & j & "='" & c.ToString() _
: & "', Position=" & c.Index)
: Next j
: Next i
: m = m.NextMatch()
: End While
--
╭──── Origin:<不良牛牧場> bbs.badcow.com.tw (210.200.247.200)─────╮
│ ↘ Welcome to SimFarm BBS -- From : [59.112.103.184] │
╰◣◣◢ ◢◢《不良牛免費撥接→電話:40586000→帳號:zoo→密碼:zoo》 ◣◣◢ ─╯
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 4 篇):
Programming 近期熱門文章
PTT數位生活區 即時熱門文章