hi, i have this pattern i using to replace string:
var html = "some test string";
var regex = new Regex(@"<(.|\n)+?>", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Multiline);
var result = regex.Replace(html, ?);
this pattern matches all html tags <anything here>
and replace with ?
. actually ?
is " "
or ""
according to match type. for example if i using below html markup:
<a href="www.google.com">Google</a><a href="www.yahoo.com">Yahoo!</a>
result is something like below:
Google?Yahoo! (here ? should be " ")
and if i using below html markup:
Buy it now for <b>$279</b><b>.99</b>!
result is something like below:
Buy it now for ?$279??.99?! (and here ? should be "")
can anybody help to improve this pattern to works properly? thanks in advance
UPDATE
OK, actually i not found an approach to do that i need, so I'm using MatchEvaluator to detect where ? should be "" and where " "! thanks a lot of ;)