开发者

Problem with Regex to detect a hyperlink in C#

开发者 https://www.devze.com 2023-03-16 17:40 出处:网络
I am working in replacing a text with a hyperlink in C#. The 开发者_JS百科problem here is.. Case 1:No problem

I am working in replacing a text with a hyperlink in C#. The 开发者_JS百科problem here is..

Case 1:No problem

Input: ASAss12345

Output:ASAss12345

Case 2:Problem here

Input: ASAss12345

Output:ASAss12345'>ASAss12345

Preferred Output: ASAss12345

How can I rectify this problem. Code her for your reference.

mailItem.HTMLBody = Regex.Replace(mailItem.HTMLBody, "(?<!http://stack.com/=)ASA[a-z][a-z][0-9][0-9][0-9][0-9][0-9](?!</a>)", "<a href='http://stack.com/=$&'>$&</a>");


Take a look at this.

i think you are looking for This

0

精彩评论

暂无评论...
验证码 换一张
取 消