如何用正则表达是把 <UL1>ffffffffff </UL1> <http://URL-STRING/>
替换成 <a target="popup-link" href="http://URL-STRING">ffffffffff </a>
-
C# code
-
string result = Regex.Replace(urlStr, "(?i)<url>([^<]*)</url><(http://[^>]+)/>","<a target=/"popup-link/" href=/"$2/">$1</a
下面这俩个是根据我的具体情况而细化的。(日文环境下的)string result = Regex.Replace(urlStr,
"(?i)<UL1>(.*?)<UL1><(http://(.*?))>",
"<a target=/"popup-link/" href=/"$2/">$1</a>");这个是多了一个“_self'”result = Regex.Replace(result,
"(?i)<UL2>(.*?)<UL2><(http://(.*?))>",
"<a href=/"$2/" onclick=/"window.open(/'$2/','_self');/">$1</a>");