源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

asp自动补全html标签自动闭合(正则表达式)

  • 时间:2022-10-22 04:57 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:asp自动补全html标签自动闭合(正则表达式)
[u]复制代码[/u] 代码如下:
Function closeHTML(strContent) Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match Set re = New RegExp re.IgnoreCase = True re.Global = True arrTags = Array("p", "div", "span", "table", "ul", "font", "b", "u", "i", "h1", "h2", "h3", "h4", "h5", "h6") For i = 0 To UBound(arrTags) OpenPos = 0 ClosePos = 0 re.Pattern = "\<" + arrTags(i) + "( [^\<\>]+|)\>" Set strMatchs = re.Execute(strContent) For Each Match in strMatchs OpenPos = OpenPos + 1 Next re.Pattern = "\</" + arrTags(i) + "\>" Set strMatchs = re.Execute(strContent) For Each Match in strMatchs ClosePos = ClosePos + 1 Next For j = 1 To OpenPos - ClosePos strContent = strContent + "</" + arrTags(i) + ">" Next Next closeHTML = strContent End Function
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部