dwe0608
asked on
Regular Expression
Hi guys,
I have a string which contains a series of characters, including html tags. I would like to preserve the text but remove all tags, replacing the paragraph end </p> tag with <br> - I have found the following script, but not understanding regular expressions makes it hard to understand what it does exactly what exactly does this function do and how can I modify it to preserve the text as I said earlier.
MTIA
DWE
I have a string which contains a series of characters, including html tags. I would like to preserve the text but remove all tags, replacing the paragraph end </p> tag with <br> - I have found the following script, but not understanding regular expressions makes it hard to understand what it does exactly what exactly does this function do and how can I modify it to preserve the text as I said earlier.
Function stripTags(HTMLstring)
Set RegularExpressionObject = New RegExp
With RegularExpressionObject
.Pattern = "<[^>]+>"
.IgnoreCase = True
.Global = True
End With
stripTags = RegularExpressionObject.Replace(HTMLstring, "")
Set RegularExpressionObject = nothing
End Function
MTIA
DWE
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The patterns finds and removes every trace of "< anything inside brackets >" inside your text.
ASKER
so will that delete something like "<input type="text" value="test value" /> including the value of text ... ? I suppose it would wouldnt it ...
ASKER
thanks for the help ...
Yes it would. Glad I could help...
ASKER