欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

vb.net正則表達(dá)式的簡(jiǎn)單介紹

vb.net正則表達(dá)式

Imports?System.Text.RegularExpressions

創(chuàng)新互聯(lián)成立于2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都做網(wǎng)站、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元元江縣做網(wǎng)站,已為上家服務(wù),為元江縣各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575

Public?Class?Form1

Public?Function?MadeRegexArray(ByVal?strText?As?String,?ByVal?strRegx?As?String,?ByVal?rexOpt?As?RegexOptions,?ByVal?Groups?As?Integer)?As?String()

REM?正則結(jié)果直接以字符串組形式返回

REM?strHtml待搜索的字符串

REM?strRegx正則表達(dá)式

REM?rexOpt正則選項(xiàng)

On?Error?Resume?Next

Return?MadeMatchString(MadeRegexMatch(strText,?strRegx,?rexOpt),?Groups)

End?Function

Public?Function?MadeMatchString(ByVal?mc?As?MatchCollection,?ByVal?Groups?As?Integer)?As?String()

REM?把MatchCollection以字符串組形式保存

REM?mc正則匹配的集合

REM?返回字符串組

On?Error?Resume?Next

Dim?strRegCode(mc.Count)?As?String

For?i?As?Integer?=?0?To?mc.Count?-?1

strRegCode(i)?=?mc(i).Groups(Groups).Value

Next?i

Return?strRegCode

End?Function

Public?Function?MadeRegexMatch(ByVal?strText?As?String,?ByVal?strRegex?As?String,?ByVal?rexOpt?As?RegexOptions)?As?MatchCollection

REM?獲取正則表達(dá)式匹配的集合

REM?strHtml待正則的字符串

REM?strRegex正則表達(dá)式

REM?rexOpt正則選項(xiàng)

REM?返回?MatchCollection?類型集合

On?Error?Resume?Next

Dim?rex?As?Regex?=?New?Regex(strRegex,?rexOpt)

Return?rex.Matches(strText)

End?Function

Public?Function?MadeRegexReplace(ByVal?sText?As?String,?ByVal?sRegex?As?String,?ByVal?sReplace?As?String)?As?String

REM?正則表達(dá)式文本替換

REM?sText原文本

REM?sRegex表達(dá)式

REM?sReplace替換文本

On?Error?Resume?Next

Dim?rex?As?Regex?=?New?Regex(sRegex,?RegexOptions.IgnoreCase)

Return?rex.Replace(sText,?sReplace)

End?Function

Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click

On?Error?Resume?Next

Dim?sRegex?As?String?=?"([\s\S]*?)"

Dim?aTable()?As?String?=?MadeRegexArray(TextBox1.Text,?sRegex,?RegexOptions.IgnoreCase,?1)

For?i?As?Integer?=?0?To?aTable.Length?-?1

TextBox2.Text?=?TextBox2.Text??aTable(i)

Next?i

End?Sub

End?Class

如圖:

VB.net中正則表達(dá)式實(shí)例

在所給代碼基礎(chǔ)上僅作修改.

首先導(dǎo)入命名空間

Imports System.Text.RegularExpressions

然后:

Function geta(ByVal Str)

Dim re As New Regex("a(.+?)href=""*([^\s]+?)""*(\s|)")

Dim Contents As MatchCollection = re.Matches(Str)

Dim links As String = Nothing

For Each Match In Contents ' 遍歷匹配集合。

links = links + Match.SubMatches(1) + "|"

Next

geta = Mid(links, 1, Len(links) - 1)

geta = Replace(geta, "'", "")

re = Nothing

End Function

vb.net正則表達(dá)式的寫法

var reg = /;SPLIT(?:(?!;SPLIT)[\s\S])*;SPLIT/g;

var str = "";

str.replace(reg,"");

VB.NET 正則表達(dá)式 日期

var?reg?=?/(.{4}年.{2}月.{2}日|.{2}年.{2}月.{2}日|[^\-]{2}\-[^\-]{2}|[^\/]{2}\/[^\/]{2}|[^\\]{2}\\[^\\]{2})/g;

var?str?=?"sdfasf****年**月**日,**年**月**日,**-**,**/**,**\**asdfadf";

str.match(reg);

VB.NET的正則表達(dá)式

Imports System.Text.RegularExpressions '引入命名空間

dim isTrue as boolean = regex.Match(textbox1.text, _

"(.*\x22.*\x22.*)|(.*\x27.*\x27.*)").Success

' 可匹配形如:"5648ffq" ,'454564565', 35235"ere"333, 434'ppp'89eru 等

'如果要匹配中文的“”、‘’

'改為:"(.*\u201C.*\u201D.*)|(.*\u2018.*\u2019.*)"

名稱欄目:vb.net正則表達(dá)式的簡(jiǎn)單介紹
標(biāo)題URL:http://www.chinadenli.net/article38/dooggsp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作移動(dòng)網(wǎng)站建設(shè)電子商務(wù)App開發(fā)企業(yè)建站網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營(yíng)