开发者

Changing html with Regex in C#

开发者 https://www.devze.com 2023-02-05 05:16 出处:网络
I\'ve got source string like <p>blablabla</p> <p><img style=\"float: left;\" src=\"../Content/attachments/455dd178-db28-4856-85e8-c65c8e6b04df_312540909.jpg\" alt=\"455dd178-db28

I've got source string like

<p>blablabla</p>
<p><img style="float: left;" src="../Content/attachments/455dd178-db28-4856-85e8-c65c8e6b04df_312540909.jpg" alt="455dd178-db28-4856-85e8-c65c8e6b04df_312540909.jpg" />blablabla</p>
<p><img style="float: right;" src="../Content/attachments/dec0f850-2921-4bf7-87b8-d2410e04a841_image001.gif" alt="dec0f850-2921-4bf7-87b8-d2410e04a841_image001.gif" width="100"开发者_开发技巧 /></p>

For each img element I need to remove alt attribute, and replace src elements with srcFileName.Substring(37).

Can't figure out the regex needed. Please help.


Had to use Html Agility Pack for this

0

精彩评论

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