zoukankan      html  css  js  c++  java
  • asp自动补全html标签自动闭合(正则表达式)

    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 
    

      

  • 相关阅读:
    函数
    关联子查询
    子查询
    视图(VIEW)
    顺时针打印矩阵
    二叉树的镜像
    树的子结构
    将两个有序链表合并
    反转链表
    输出链表中倒数第k个结点
  • 原文地址:https://www.cnblogs.com/uuxanet/p/3298831.html
Copyright © 2011-2022 走看看