C# 如何用HTML替换文本替换定制代码标记/标记?

C# 如何用HTML替换文本替换定制代码标记/标记?,c#,.net,asp.net,regex,C#,.net,Asp.net,Regex,我在一些论坛帖子中使用了一些定制的标记/标签,我正在寻找一种合适的方法来处理它们(很可能是使用正则表达式,我不太擅长使用它!) 当我把论坛帖子呈现到屏幕上时,我想转换文本中的定制标签,将它们转换成真正的标签。在一篇文章中,每个定制标签都可能有多个需要处理的实例 以下是我需要处理的示例: [URL=http://www.mysite.com]anchor text[/URL] [URL=www.mysite.com]anchor text[/URL] 需要替换为: <a href="htt

我在一些论坛帖子中使用了一些定制的标记/标签,我正在寻找一种合适的方法来处理它们(很可能是使用正则表达式,我不太擅长使用它!)

当我把论坛帖子呈现到屏幕上时,我想转换文本中的定制标签,将它们转换成真正的标签。在一篇文章中,每个定制标签都可能有多个需要处理的实例

以下是我需要处理的示例:

[URL=http://www.mysite.com]anchor text[/URL]
[URL=www.mysite.com]anchor text[/URL]
需要替换为:

<a href="http://www.mysite.com">anchor text</a>
<a href="mailto:me@mysite.com">anchor text</a>
<img src="http://www.mysite.com/image.jpg" />
<div class="quote"><h3>Posted by: username</h3>quoted text</div>
需要替换为:

<a href="http://www.mysite.com">anchor text</a>
<a href="mailto:me@mysite.com">anchor text</a>
<img src="http://www.mysite.com/image.jpg" />
<div class="quote"><h3>Posted by: username</h3>quoted text</div>
需要替换为:

<a href="http://www.mysite.com">anchor text</a>
<a href="mailto:me@mysite.com">anchor text</a>
<img src="http://www.mysite.com/image.jpg" />
<div class="quote"><h3>Posted by: username</h3>quoted text</div>
需要替换为:

<a href="http://www.mysite.com">anchor text</a>
<a href="mailto:me@mysite.com">anchor text</a>
<img src="http://www.mysite.com/image.jpg" />
<div class="quote"><h3>Posted by: username</h3>quoted text</div>
发布人:usernamequoted text


使用100种不同的替代品,使用
检查。不喜欢。