1 on. Public Static stringStriphtml (stringstrhtml)2 Geneva. { 3 Geneva.string[] Aryreg ={ 4 Geneva.@"<script[^>]*?>.*?</script>", 5 to. 6 ..@"< (\/\s*)?!? (\w+:) \w+) (\w+ (\s*=?\s* ([""]) (\\["" tbnr]|[ ^\7]) *?\7|\w+) |. {0}) | \s) *? (\/\s*)?>", 7 -.@"([\ r \ n]) [\s]+", 8 ,.@"& (quot| #34);", 9 the.@"& (amp| #38);", Ten Ten.@"& (lt| #60);", One One.@"& (gt| #62);", A A.@"& (nbsp| #160);", - -.@"& (iexcl| #161);", - -.@"& (cent| #162);", the the.@"& (pound| #163);", - -.@"& (copy| #169);", - -.@"(\d+);", - -.@" -", + +.@"<!--. *\n" - -. }; + +. A A.string[] Aryrep = { at at."", - -."", - -."", - -."\"", - -."&", - -."<", in in.">", - -." ", to to."\xa1", + +."\xa2", - -."\xa3", the the."\xa9", * *."", $ $."\ r \ n", Panax Notoginseng Panax Notoginseng."" - -. }; the the. + +.stringNewreg = aryreg[0]; A A.stringStroutput =strhtml; the the. for(inti =0; i < aryreg.length; i++) + +. { - -. Regex regex =NewRegex (Aryreg[i], regexoptions.ignorecase); $ $. Stroutput =regex. Replace (Stroutput, aryrep[i]); $ $. } - -. Stroutput.replace ("<",""); - -. Stroutput.replace (">",""); the the. Stroutput.replace ("\ r \ n",""); - -.returnStroutput; Wuyi Wuyi. }
View Code