reubenb
10-06-2005, 01:56 PM
hiya
so i have this removehtml regex script:
function ClearHTMLTags(strHTML, intWorkFlow)
'Variables used in the function
dim regEx, strTagLess
'---------------------------------------
strTagless = strHTML
'Move the string into a private variable
'within the function
'---------------------------------------
'regEx initialization
'---------------------------------------
set regEx = New RegExp
'Creates a regexp object
regEx.IgnoreCase = True
'Don't give frat about case sensitivity
regEx.Global = True
'Global applicability
'---------------------------------------
'Phase I
' "bye bye html tags"
if intWorkFlow <> 1 then
'---------------------------------------
regEx.Pattern = "<[^>]*>"
'this pattern mathces any html tag
strTagLess = regEx.Replace(strTagLess, "")
'all html tags are stripped
'---------------------------------------
end if
'Phase II
' "bye bye rouge leftovers"
' "or, I want to render the source"
' "as html."
'---------------------------------------
'We *might* still have rouge < and >
'let's be positive that those that remain
'are changed into html characters
'---------------------------------------
if intWorkFlow > 0 and intWorkFlow < 3 then
regEx.Pattern = "[<]"
'matches a single <
strTagLess = regEx.Replace(strTagLess, "<")
regEx.Pattern = "[>]"
'matches a single >
strTagLess = regEx.Replace(strTagLess, ">")
'---------------------------------------
end if
'Clean up
'---------------------------------------
set regEx = nothing
'Destroys the regExp object
'---------------------------------------
'---------------------------------------
ClearHTMLTags = strTagLess
'The results are passed back
'---------------------------------------
end function
but i want to change it so when intWorkFlow is 0, [removing/stripping the html tags], it will replace the <br> and <p> with a
i also want to know how to do an exception, like if the tags are <img> to leave them and not strip them
how can i do this?
please?? :thumbsup:
so i have this removehtml regex script:
function ClearHTMLTags(strHTML, intWorkFlow)
'Variables used in the function
dim regEx, strTagLess
'---------------------------------------
strTagless = strHTML
'Move the string into a private variable
'within the function
'---------------------------------------
'regEx initialization
'---------------------------------------
set regEx = New RegExp
'Creates a regexp object
regEx.IgnoreCase = True
'Don't give frat about case sensitivity
regEx.Global = True
'Global applicability
'---------------------------------------
'Phase I
' "bye bye html tags"
if intWorkFlow <> 1 then
'---------------------------------------
regEx.Pattern = "<[^>]*>"
'this pattern mathces any html tag
strTagLess = regEx.Replace(strTagLess, "")
'all html tags are stripped
'---------------------------------------
end if
'Phase II
' "bye bye rouge leftovers"
' "or, I want to render the source"
' "as html."
'---------------------------------------
'We *might* still have rouge < and >
'let's be positive that those that remain
'are changed into html characters
'---------------------------------------
if intWorkFlow > 0 and intWorkFlow < 3 then
regEx.Pattern = "[<]"
'matches a single <
strTagLess = regEx.Replace(strTagLess, "<")
regEx.Pattern = "[>]"
'matches a single >
strTagLess = regEx.Replace(strTagLess, ">")
'---------------------------------------
end if
'Clean up
'---------------------------------------
set regEx = nothing
'Destroys the regExp object
'---------------------------------------
'---------------------------------------
ClearHTMLTags = strTagLess
'The results are passed back
'---------------------------------------
end function
but i want to change it so when intWorkFlow is 0, [removing/stripping the html tags], it will replace the <br> and <p> with a
i also want to know how to do an exception, like if the tags are <img> to leave them and not strip them
how can i do this?
please?? :thumbsup: