正则表达式学习
namespace 正则表达式学习
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) //botton1
{
Regex re = new Regex(@textBox1.Text); //textBox1 正则表达式的输入框
Match ma = re.Match(textBox2.Text); //textBox2 需要验证的字符串的输入框
if (ma.Success)
label1.Text="匹配"; //label1 显示验证结果
else
label1.Text="不匹配";
}
}
}