62,046
社区成员
发帖
与我相关
我的任务
分享
string str = @"^^
~~狮子纪念碑~~
**狮子纪念碑(Lion Monument)是卢塞恩数一数二的雕刻作品。**
@@卡贝尔桥狮子纪念碑@@
^^
^^
~~AAAA~~
**BBBB**
@@CCCC@@
^^";
string result = Regex.Replace(str, @"(?is)\^\^(.*?)\^\^", "<div>$1</div>");
result = Regex.Replace(result, @"(?is)~~(.*?)(?=~~)~~", "<span class=\"Item1\">$1</span>");
result = Regex.Replace(result, @"(?is)\*\*(.*?)(?=\*\*)\*\*", "<span class=\"Item2\">$1</span>");
result = Regex.Replace(result, @"(?is)@@(.*?)(?=@@)@@", "<span class=\"Item3\">$1</span>");
Console.WriteLine(result);