VB: 一个正则提取功能
'引用:Microfoft VBScript Regular Expressions 5.5 '一个正则提取功能
Public Function regGetStr_three(ByVal myString As String, ByVal patReg As String) As String()
Dim objRegExp As RegExp
Dim objMatch As Match
Dim colMatches As MatchCollection
Dim RetStr As String
Dim y() As String, j As Integer
ReDim y(0)
Set objRegExp = New RegExp
' objRegExp.Pattern = "a\[\d{1,3}\]=""?(.{1,})""?\.split"
objRegExp.Pattern = patReg
objRegExp.IgnoreCase = True
objRegExp.Global = True j = -1
If (objRegExp.Test(myString) = True) Then
Set colMatches = objRegExp.Execute(myString)
For Each objMatch In colMatches
j = j + 1
ReDim Preserve y(j)
y(j) = objMatch.SubMatches(0) + "," + objMatch.SubMatches(1) + "," + objMatch.SubMatches(2)
Next
Else
RetStr = "String Matching Failed"
End If
regGetStr_three = y End Function
相关文档:
VERSION 5.00
Begin VB.Form frmMain
BorderStyle = 1 'Fixed Single
Caption = "Reg Demo"
ClientHeight = 6570
ClientLeft = 45
ClientTop = 435
ClientWidth = 7695
LinkTopic = "Form1"
MaxButton = 0 'False
Min ......
写了一个vb的程序,用来把原来写的几个vb和vc的程序整合起来。就是使用Shell函数。结果发现,vc的程序可以很好的显示,但vb写的却一运行就最小化了。仔细查看了一下以下文章,才发现原来shell函数的默认显示模式是windowstyle是等于vbMinimizedFocus。然后就是直接加上一个vbNormalFocus。一切ok!
vb的s ......
Option Explicit
Public Function ascii2Char(strInput As String) As String
Dim i As Integer
Dim strTemp As String
Dim nPos As Integer
Dim nValue As Integer
i = 1
nPos = InStr(i, strInput, "&#", vbTextCompare)
While (nPos > 0)
ascii2Char = ascii2Char + Left(st ......