It would be great if someone could help me with the regex. This is my code:
Regex.Replace("<_img src=\"abc.png\" /><_img class=\"shwimg\" 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\" />"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.