http://runjs.cn/detail/99epj1t2
http://www.cqroad.cn/
https://jsplumbtoolkit.com/demo/flowchart/dom.html
正则表达式的用法
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Text.RegularExpressions; using System.IO; namespace ConvertHtml { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void buttonConvert_Click(object sender, EventArgs e) { ConvertFiles(richTextBoxFrom.Text); } private void ConvertFiles(string path) { string[] aspxFiles = Directory.GetFiles(path, "*.aspx", SearchOption.AllDirectories); foreach (string filePath in aspxFiles) { string fileContent = File.ReadAllText(filePath); if (!string.IsNullOrEmpty(fileContent)) { fileContent = AddMasterPageIntoPage(fileContent); File.WriteAllText(filePath, fileContent); } } } private string ReplaceIngoreCase(string source, string oldValue, string newValue) { var regex = new Regex(oldValue, RegexOptions.IgnoreCase); return regex.Replace(source, newValue); } private string AddMasterPageIntoPage(string strHtmlFrom) { if (strHtmlFrom.IndexOf("frameset") >= 0) return strHtmlFrom; strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "<body.*>", "<asp:Content ID=\"bodyContent\" ContentPlaceHolderID=\"mainContent\" runat=\"server\">"); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "</body>", "</asp:Content>"); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "</html>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "<head>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "</head>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "<!DOCTYPE HTML.*>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "<html>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "<meta.*>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, @"<title>.*</title>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, @"<link (.*)css.css(.*)>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, @"<link (.*)style2.css(.*)>", ""); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "<script language=\"javascript\">", "<asp:Content ID=\"scriptContent\" ContentPlaceHolderID=\"headContent\" runat=\"server\"><script language=\"javascript\">"); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "</script>", "</script></asp:Content>"); strHtmlFrom = Regex.Replace(strHtmlFrom, "<font face='宋体'>(?<content>.*)</font>", "${content}", RegexOptions.IgnoreCase); strHtmlFrom = Regex.Replace(strHtmlFrom, "<font face=\"宋体\">(?<content>.*)</font>", "${content}", RegexOptions.IgnoreCase); strHtmlFrom = ReplaceIngoreCase(strHtmlFrom, "<font face='宋体'>|<font face=\"宋体\">", ""); return strHtmlFrom; } } }