\S[^\)]+)\)(?.[^\(]*)\(\/url\)", "<a href="/index.htm">${title}</a>", RegexOptions.IgnoreCase | RegexOpti" /> <link href="/Styles/article.css" rel="stylesheet" type="text/css"> <style> .pagelist { margin-top: 10px; height: 30px; width: 600px; text-align: center; } .pagelist u { float: center; padding: 5px 10px; margin-right: 5px; font-size: 12px; } .pagelist a { float: center; padding: 5px 10px; border: 1px solid #ccc; margin-right: 5px; font-size: 12px; text-decoration: none; } .pagehtml { height: 30px; padding: 5px 10px; margin: 10px 0px; line-height: 30px; background: #efefef; } .pagehtml span { display: inline-block; width: 48%; font-size: 14px; margin-right: 10px; overflow: hidden; text-overflow: ellipsis; -o-text-overflow: ellipsis; white-space: nowrap; } .art_content p { margin-left:2em; } .relate_search { width: 665px; position: relative; display: block; margin-bottom: -1px; background-color: rgb(255, 255, 255); border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; } .relate_search ul { padding: 10px 15px; } .relate_search ul li { list-style: none; float: left; margin-bottom: 0px; margin-right: 25px; line-height: 25px; } .relate_search ul li a { color: #666; font-size: 14px; text-decoration: underline; } </style> <style> .topmenu2 ul li{width:8%} .topmenu2 ul li:hover{width:8%} </style>
您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> .NET >> 正则表达式 关于正则表达式。找了很多资料没解决。

正则表达式 关于正则表达式。找了很多资料没解决。

来源:网络整理     时间:2016/8/29 10:37:04     关键词:正则表达式

关于网友提出的“正则表达式 关于正则表达式。找了很多资料没解决。”问题疑问,本网通过在网上对“正则表达式 关于正则表达式。找了很多资料没解决。”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题:正则表达式 关于正则表达式。找了很多资料没解决。
描述:

content = Regex.Replace(content, @"\(url\s*=\s*(?\S[^\)]+)\)(?.[^\(]*)\(\/url\)", "<a href=\"${url}\">${title}", RegexOptions.IgnoreCase | RegexOptions.Compiled);<br> 这是把 (url=http://abc.mywebsite.com/default.aspx)myweb(/url)  替换成 <br> <a href="http: abc.mywebsite.com/default.aspx"="">myweb<br> 如果myweb中含有括号 ) 就替换不成功了,就是因为这个 [^\)] ,那位告诉我怎么弄啊 我把[^\)] 换成 [^(\(url)] 不成功,请高手指教。<br></a href="http:></a href=\"${url}\">


解决方案1:

帮顶

解决方案2:

ResultString = Regex.Replace(yourStr, "\\(url\\s*=\\s*(?http://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|])\\s*\\)(?.+?)\\(/url\\)", "${content}");
满足你的要求。

解决方案3:

[^\)] 换成[^\(]


以上介绍了“正则表达式 关于正则表达式。找了很多资料没解决。”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3657810.html

正则表达式相关图片

正则表达式相关文章