.Net在线编辑工具.NET Fiddle

推荐工具:.NET Fiddle

推荐理由:在线调试,编译,运行.net代码,同时支持C#,VB.NET,F#

推荐说明::对于.NET开发者来说是福音,因为我们可以不用再担心环境与庞大的IDE的问题,不管在任何时间,任何环境,如果有了什么点子,打开dotnetfiddle.net,输入你的代码;总的来说,它能够让你在浏览器窗体重复折腾代码片段而无需运行Visual Studio。当你仅仅是调试少量代码时这实在是太方便了。.NET Fiddle的一个最大卖点就是它是免费的。

网站截图:

看看我的代码

using System;
public class Program{  public static void Main()  {    string img = "i<img style='aaa' />j<Img style='bbb' />k<img style='ccc' ></img>";    Console.WriteLine(ReplacehtmlBody(img));    Console.WriteLine(ReplacehtmlBody2(img));  }
  public static string ReplaceRegex(string content, string regParen, string replyContent)  {    string strOutput = System.Text.RegularExpressions.Regex.Replace(content, regParen, replyContent);    return strOutput;  }
  public static string ReplacehtmlBody(string htmlBody)  {    if (string.IsNullOrWhiteSpace(htmlBody))    {      return htmlBody;    }
    return ReplaceRegex(htmlBody, "(i?)(\\<img.*?style=['\"])([^\\>]+\\>)", "$2max-width: 80% !important;$3");  }
  public static string ReplacehtmlBody2(string htmlBody)  {    if (string.IsNullOrWhiteSpace(htmlBody))    {      return htmlBody;    }
    var reg = new System.Text.RegularExpressions.Regex("(\\<img.*?style=['\"])([^\\>]+\\>)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);    return reg.Replace(htmlBody, "$1max-width: 80% !important;$2");  }}

 

<img style='max-width: 80% !important;aaa' />j<Img style='bbb' />k<img style='max-width: 80% !important;ccc' ></img>i<img style='max-width: 80% !important;aaa' />j<Img style='max-width: 80% !important;bbb' />k<img style='max-width: 80% !important;ccc' ></img>

地址:

https://dotnetfiddle.net/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值