求一个正则表达式的写法,先谢了!
--------------------编程问答--------------------Option Explicit--------------------编程问答-------------------- 第2个:
Private Sub Command1_Click()
Dim tem$
tem = "<input onclick=""javascript:call('12342')"">测试1</input><input onclick=""javascript:call('1345')"">测试2</input><input onclick=""javascript:call('2345')"">测试3</input><input onclick=""javascript:call('1235')"">测试4</input><input onclick=""javascript:call('13345')"">测试5</input><input onclick=""javascript:call('12145')"">测试6</input><input onclick=""javascript:call('12335')"">测试4</input><input onclick=""javascript:call('12341')"">测试8</input><input onclick=""javascript:call('12745')"">测试9</input><input onclick=""javascript:call('12545')"">测试11</input>"
Call GetNum(tem)
End Sub
Private Sub GetNum(ByVal Source$)
On Error Resume Next
Dim RegExp As Object, Matches As Object
Dim i&
Set RegExp = CreateObject("VBscript.RegExp")
RegExp.Global = True
RegExp.Pattern = "'(\d+)'"
Set Matches = RegExp.Execute(Source)
For i = 0 To Matches.Count - 1
Debug.Print Matches(i).SubMatches(0)
Next i
Set RegExp = Nothing
Set Matches = Nothing
End Sub
RegExp.Pattern = "'\)"">(.*?)<"
改成这样就好了。
补充:VB , 基础类