VB 乙個正則提取功能

2021-05-10 16:25:11 字數 1001 閱讀 2053

'引用: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/]=""?(.)""?/.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

還有乙個vb問題

這是為什麼啊?望高人指點啊.private sub form load dim machine as string dim machine decode as string dim txtsql as string dim mrc as adodb.recordset dim msgtext as ...

乙個VB陣列指標類

顧名思義了,這個 就是將指定的記憶體位址繫結到乙個vb陣列,即com中的safearray上。所謂繫結,是指在使用該記憶體位址之前,並不需要申請相應的本地記憶體緩衝區,也不需要進行記憶體複製,只是根據該位址憑空構造乙個vb陣列,並將陣列的真實資料位址指向該位址。當然,該類的功能完全可以用copyme...

VB寫乙個IE外掛程式

用vb編寫ie外掛程式 實現方法如下 首先需要獲得iobjectwithsite介面的定義,你下載個olelib.tlb,包含了介面定義。然後建立乙個 activex dll工程,在工程中引用這個tlb檔案,並且引用microsoft html object library mshtml.dll 和...