using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.IO; using System.Net; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; namespace Znyc.Cloudcar.Admin.Commons.Extend { /// /// 字符串处理 /// public static class ExtString { /// /// email正则验证 /// private static readonly Regex emailExpression = new(@"^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.Compiled); /// /// url正则验证 /// private static readonly Regex webUrlExpression = new(@"(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?", RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.Compiled); /// /// private static readonly Regex stripHTMLExpression = new("<\\S[^><]*>", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled); /// /// 过滤html格式 /// /// /// public static string NoHTML(this string Htmlstring) { Htmlstring = Regex.Replace(Htmlstring, @"", "", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"", "", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"", "", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"<.*?>", "", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", " ", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", " ", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"-->", " ", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"