用正则表达式提取字符串 我想从原字符串:str = "*:我们123erewt;"中提取出“我们123erewt”,正则表达式怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 本帖最后由 lxcnn 于 2011-02-17 21:00:22 编辑 string str = "*:我们123erewt;"; foreach (Match m in Regex.Matches(str, @"(?s)[^>]*:(?<title>[^>]*)")) { Console.WriteLine(m.Groups["title"].Value); }我们123erewt; try... string str = "*:我们123erewt;"; Regex reg = new Regex(@"(?<=:)[^;]+(?=;)"); MatchCollection mc = reg.Matches(str); foreach (Match m in mc) { richTextBox2.Text += m.Value + "\n"; } static void Main(){ string str = "*:我们123erewt;"; //中提取出“我们123erewt”,正则表达式怎么写? Regex r = new Regex("(?<=:)[^:;]*(?=;)"); string s = r.Match(str).Value; //s = 我们123erewt}楼主能不能尊重一下回答的人?这么多正确答案都不选???? C#中foreach问题 yield return疑问 C#中遍历文件夹目录的问题 shgetfileinfo 如何将Icon显示在网页上? 程杰的《大话设计模式》,有个地方不是很明白 vs2005 刚启动的那个界面,有很多配置选项的,比如vs team,vs c#等,但是VS 启动速度很快,让人无法选择,如何可以选择不同的配置选项! remoting问题,牛人进来,一经解答,立即散分!!!! 关于form【设计器】视窗的问题? 如何知道一个实例变量已经实例化了! 用Response.Redirect只能在同一个页面下跳转网址,我使用IMAGEBUTTON想在一个新的IE里显示跳转,怎么做? 如何删除选中datagridview所对应的数据库信息 backgroundworker的问题
foreach (Match m in Regex.Matches(str, @"(?s)[^>]*:(?<title>[^>]*)"))
{
Console.WriteLine(m.Groups["title"].Value);
}我们123erewt;
Regex reg = new Regex(@"(?<=:)[^;]+(?=;)");
MatchCollection mc = reg.Matches(str);
foreach (Match m in mc)
{
richTextBox2.Text += m.Value + "\n";
}
static void Main()
{
string str = "*:我们123erewt;"; //中提取出“我们123erewt”,正则表达式怎么写?
Regex r = new Regex("(?<=:)[^:;]*(?=;)");
string s = r.Match(str).Value; //s = 我们123erewt
}楼主能不能尊重一下回答的人?
这么多正确答案都不选????