Function closehtml (strcontent)
*************************************
Auto-close HTML
*********************
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 all Match in strmatchs
Closepos = closepos + 1
Next
for j = 1 to Openpos-cl Osepos
Strcontent = strcontent + "</" + arrtags (i) + ">"
Next
Next
closehtml = strcontent
S et re = Nothing
End Function
Function closeUBB (strcontent)
*************************************
Auto close UBB
*************************************
Dim arrtags, I, Openpos, Closepos, Re, Strmatchs, J, Match
Set re = New RegExp ' Declare re object
Re. IgnoreCase = True ' Sets whether the character case
Re is case-sensitive. Global = True ' Set globally available
Arrtags = Array ("code", "quote", "list", "Color", "Align", "Font", "Size", "B", "I", "U", "htm" L ")
Set up an array to store the tags that need to detect whether the closed label
for i = 0 to UBound (arrtags) ' loops each element in the array to detect
Openpos = 0 ' Initialize the number of current tag start tags
Closepos = 0 ' Initializes the number of current tag end tags
Re. pattern = "[" + arrtags (i) + "(=[^[]]+|)]" ' Start with the number of start and end tags, respectively.
Set Strmatchs = Re. Execute (strcontent)
for each Match in Strmatchs
Openpos = openpos + 1
Next
Re. Pattern = "[/" + arrtags (i) + "]"
Set strmatchs = Re. Execute (strcontent)
for all Match in strmatchs
Closepos = closepos + 1
Next
for j = 1 to Openpos-cl Osepos ' When the number of start and end tags is inconsistent, close the current label
Strcontent = strcontent + "[/" + arrtags (i) + "]"
Next
Next
Closeubb = s Trcontent
Set re = Nothing
End Function