您的位置:首页 > 其它

最近再学习一下正则表达式 写了个小工具自己测试

2011-04-07 17:13 344 查看
好久没写Form 代码了,手都有点痒了..

写了个正则表达式测试软件

代码很少命名规范这些 就忽略了哈...呵呵

private void textBox2_TextChanged(object sender, EventArgs e)
{
if (textBox2.Text != "" && textBox1.Text!="")
{
if (checkBox1.Checked)
{
textBox3.Text = "";
}
try
{
MatchCollection c = Regex.Matches(textBox2.Text, textBox1.Text);
foreach (Match item in c)
{
textBox3.Text = textBox3.Text + item.Value + "\r\n";
}
}
catch (Exception ex)
{
textBox3.Text = textBox3.Text + ex.Message + "\r\n";
}
textBox3.SelectionStart = textBox3.Text.Length; //使滚动条在最下
textBox3.ScrollToCaret();
}
}

private void button1_Click(object sender, EventArgs e)
{
textBox3.Text = "";
}


源码见附件!

http://files.cnblogs.com/gaoshan/form3.rar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: