正则 比如我想找到和第一位与第三位相同的数字,如何办 123456反对反对fffdf1313 =>13 13abcdef fdfac =>ac 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 捕获一位和第三位的字符 测试反向引用的(g)lkklk(k)(\1\2) 1h2kokkokoijugu几乎,llhu好好1212被捕获 (?<=(?<f>.).(?<s>.).*)\k<f>\k<s> (?<=(?<f>.).(?<s>.).*)\k<f>\k<s>为什么要在外层加一个()? static void Main() { string str = "abcedf"; Regex re = new Regex(@"(?<ch1>\w)\w(?<ch2>\w).*?"); string expect = re.Match(str).Groups["ch1"].Value + re.Match(str).Groups["ch2"].Value; string[] strarr = new string[] {"ac","acd","add" }; foreach (string s in strarr) { if(s==expect) Console.WriteLine(s); } }这样? (?<=exp) 匹配exp后面的位置 第一个是(? <f>.) 第2个是. 第3个是(? <s>.) 后面n多是.*si写错了吧 这个外层的括号是跟(?<=xxx)组合的,匹配前面是xxx的位置(但不匹配xxx的文本),没有?<=的语法,不带括号就变成3个符号了 看客客的blog之前可以看看这个 (.).(.).*?\1\2 粗糙code(? <=(? <f>.).(? <s>.).*)\k <f>\k <s> 精华 客客的这样就满足要求了(?<=(.).(.)).*?(?<target>\1\2) 網站的TAG功能怎么實現的? 关于~表示路径的问题。 asp.net定时采集 问题 请看下小弟这是错在哪里阿?? 关于asp.net后台管理页面的设计,急等大虾帮助! DataGrid里想做一个SelectedIndexChanged事件,出现问题。。 在创建WEB应用程序的时候报错:此项目的默认Web访问模式设置为文件共享,但是无法从路径 请教一个问题!顶者有分! UserControl中的路径问题 .NET 页面加载失败问题 还是文件上传 帮忙看哪里有问题 求助,如何确定一个页面是否从指定路径进来的。
(g)lkklk(k)(\1\2)
12被捕获
为什么要在外层加一个()?
{
string str = "abcedf";
Regex re = new Regex(@"(?<ch1>\w)\w(?<ch2>\w).*?");
string expect = re.Match(str).Groups["ch1"].Value + re.Match(str).Groups["ch2"].Value;
string[] strarr = new string[] {"ac","acd","add" };
foreach (string s in strarr)
{
if(s==expect)
Console.WriteLine(s);
} }这样?
这个外层的括号是跟(?<=xxx)组合的,匹配前面是xxx的位置(但不匹配xxx的文本),没有?<=的语法,不带括号就变成3个符号了
code(? <=(? <f>.).(? <s>.).*)\k <f>\k <s> 精华
(?<=(.).(.)).*?(?<target>\1\2)