追问
代码是什么 能贴一下吗
追答
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = "http:dsfsdf.asp http:4554.asp http:12.asp http:225.htm";
textBox3.Text = @"(http:.+?(asp|htm))";
}
private void button1_Click(object sender, EventArgs e)
{
textBox2.Clear();
string pattern = textBox3.Text;
MatchCollection matchs = Regex.Matches(textBox1.Text, pattern);
foreach (Match match in matchs)
textBox2.SelectedText = "[" + match.ToString () + "]\r\n";
//textBox2.SelectedText = match.Value + "\r\n";
}
}
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询