基本信息
源码名称:C# 通用正则表达式 测试工具【附完整源码下载】
源码大小:0.17M
文件格式:.zip
开发语言:C#
更新时间:2016-01-20
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

下面是从网页中提取邮箱的例子

下面是 从文本中替换数字的例子


            if (!string.IsNullOrEmpty(this.findSource.Text) && !string.IsNullOrEmpty(this.findPattern.Text))
            {
                this.SetControlEnabled("find", false);
                try
                {
                    this.findResultTitle.Text = "正在匹配数据,请稍候....";
                    Application.DoEvents();
                    RegexOptions regexOptions = this.GetRegexOptions("find");
                    Regex regex = new Regex(this.findPattern.Text, regexOptions);
                    Stopwatch stopwatch = new Stopwatch();
                    stopwatch.Start();
                    MatchCollection mc = regex.Matches(this.findSource.Text);
                    stopwatch.Stop();
                    string str = string.Format("匹配完成(花费时间:{0} ms/{1} seconds)", stopwatch.ElapsedMilliseconds, Math.Round((double) (((double) stopwatch.ElapsedMilliseconds) / 1000.0), 2));
                    this.findResultTitle.Text = str   ",正在处理匹配结果的显示,请稍候....";
                    Application.DoEvents();
                    this.DisplayFindResultTree(regex, mc);
                    int count = mc.Count;
                    if ((count > 500) && (MessageBox.Show("本次成功匹配记录总数为"   mc.Count.ToString()   "项,是否需要一次性显示所有结果?\r\n如果“是”的话可能需要花费较多时间处理,建议选择“否”只显示前500项。", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No))
                    {
                        count = 500;
                    }
                    Match[] matchs = new Match[count];
                    for (int i = 0; i < count; i  )
                    {
                        matchs[i] = mc[i];
                    }
                    this.DisplayFindResult(matchs);
                    this.findResultTitle.Text = str;
                }
                catch (Exception exception)
                {
                    this.findResult.Text = string.Empty;
                    this.findResult.SelectionColor = Color.Red;
                    this.findResult.AppendText(string.Format("发生错误: \r\n{0}", exception.Message));
                }
                this.SetControlEnabled("find", true);
            }