Reputation: 35359
I'm using the following RegEx to strip HTML tags from a string
<[^>]*>
This does not get rid of blank lines, however. I found this other RegEx that successfully removes any blank lines:
[#Chr(13)##Chr(10)#]+
I tried to combine both as such:
ReReplaceNoCase(arguments.string, "(<[^>]*>)([#Chr(13)##Chr(10)#]+)", "", "ALL")
But this does not work. I'm using ColdFusion to do this, which should explain the #
signs.
I thought the ()
were used to group operators in RegEx, but it does not seem to work in my attempt to combine the two expressions.
Upvotes: 0
Views: 175
Reputation: 2539
stripcr(ReReplaceNoCase(arguments.string, "(<[^>]*>)", "", "ALL"))
Upvotes: 1
Reputation: 839044
Assuming that the two regular expressions you have work as you want then you can combine them using an alternation:
<[^>]*>|[#Chr(13)##Chr(10)#]+
I strongly suspect though that the regular expressions you have posted don't in fact work correctly. I'd advise you not to use regular expressions to parse HTML as HTML is not a regular language. Use an HTML parser instead.
Upvotes: 1