求正则匹配 表达式
字符串aabbaabbaabb
我想匹配aabbaabbaabb
如何写?? --------------------编程问答-------------------- rule? --------------------编程问答-------------------- (?<=aabb)(\w+?)(?=aabb)
以aabb开头,以aabb结尾的中间字符串。 --------------------编程问答-------------------- --------------------编程问答-------------------- 不讲清楚规则 不好写 --------------------编程问答-------------------- 我涉及到循环匹配
1234-abcd-1234-asdfjalal-llq-hh11-sssdf-llq
1234-abce-1234-asdfjalal-llq-hh11-sssdf-llq
1234-abcf-1234-asdfjalal-llq-hh11-sssdf-llq
--------------------编程问答-------------------- 1234-abcd-1234-asdfjalal-llq-hh11-sssdf-llq++++++++++++1234-abce-1234-asdfjalal-llq-hh11-sssdf-llq++++++++++++++1234-abcf-1234-asdfjalal-llq-hh11-sssdf-llq --------------------编程问答-------------------- 这个如何匹配,这是我的本意.都在一行中. --------------------编程问答-------------------- 还是没说出你的匹配规则 --------------------编程问答-------------------- 以4位数字-4位字母-开始,以-llq-hh11-sssdf-llq结束的中间部分???
--------------------编程问答--------------------
这样还是比较有规律的 --------------------编程问答-------------------- string str="1234-abcd-1234-asdfjalal-llq-hh11-sssdf-llq++++++++++++1234-abce-1234-asdfjalal-llq-hh11-sssdf-llq++++++++++++++1234-abcf-1234-asdfjalal-llq-hh11-sssdf-llq";
MatchCollection mc = Regex.Matches(str, @"\b\w+\b-\b\w+\b-(\b\w+\b-\b\w+\b-\b\w+\b)-\b\w+\b-\b\w+\b-\b\w+\b");
foreach (Match item in mc)
{
Console.WriteLine(item.Groups[1].ToString());
}
补充:.NET技术 , ASP.NET