开发者

Remove a substring using Regex

It would be great if someone could help me with the regex. This is my code:

Regex.Replace("<_img src=\"abc.png\" /><_img class=\"sh开发者_如何学运维wimg\" alt=\"\" width=\"20\" height=\"20\" src=\"/images/img/do.png\" />",
                    "<_img .*? src=\"/images/img/do.png\" />", string.Empty)

I need to remove the occurrence of the string:

<_img class="shwimg" alt="" width="20" height="20" src="/images/img/do.png" />

The order of the occurence of

class="shwimg" alt="" width="20" height="20"

may vary, hence I've given .*? in the pattern. However, the pattern I've given doesnt work and I'm not able to replace the string.


Is this the regex you're looking for?:

<_img [^>]*src="/images/img/do.png" />

(here's the same with escaped double-quotes, ready for use in your Regex.Replace call):

"<_img [^>]*src=\"/images/img/do.png\" />"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜