Classic ASP: encoding text outside tags with regex -


i'm in need of function process string , replace textual parts html encoded ones:

sample 1

input: "<span>total amount:<br>€ 50,00</span>" output: "<span>total amount:<br>&euro; 50,00</span>" 

sample 2

input: "<span>when threshold > x<br>act described below:</span>" output: "<span>when threshold &gt; x<br>act described below:</span>" 

these simplified cases of course, , yes, know series of replace on each specific char need encode, i'd rather have function can recognize , skip html tags using regex , perform server.htmlencode on textual part of input string. highly appreciated.

i'm not sure why you'd want this. why don't pass innerhtml parser using javascript , have javascript create span tag? can encode entire thing. i'd worried encoding here won't have added security application if that's trying do.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -