怎么在WinForm中利用正则表达式提取内容
怎么在WinForm中利用正则表达式提取内容?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

成都创新互联公司成都企业网站建设服务,提供做网站、网站设计网站开发,网站定制,建网站,网站搭建,网站设计,自适应网站建设,网页设计师打造企业风格网站,提供周到的售前咨询和贴心的售后服务。欢迎咨询做网站需要多少钱:028-86922220
代码如下:
using System;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace HoverTreeBatch.HoverTree
{
public partial class RegexForm : Form
{
public RegexForm()
{
InitializeComponent();
textBox_regex.Text = @"
]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>";
textBox_content.Text = @"";
}
private void button_ok_Click(object sender, EventArgs e)
{
Regex m_hvtRegImg = new Regex(textBox_regex.Text, RegexOptions.IgnoreCase);
//搜索匹配的字符串
MatchCollection hewenqi_matches;
try
{
hewenqi_matches = m_hvtRegImg.Matches(textBox_content.Text);
// 取得匹配项列表
foreach (Match match in hewenqi_matches)
{
textBox_result.Text = textBox_result.Text + match.Groups["hewenqitext"].Value + "\r\n";
}
}
catch (Exception ex)
{
textBox_result.Text = ex.ToString();
}
}
}
}
/*
*/ 关于怎么在WinForm中利用正则表达式提取内容问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。
网站题目:怎么在WinForm中利用正则表达式提取内容
URL网址:http://www.scyingshan.cn/article/gjgoeg.html


咨询
建站咨询
