为什么我的Regex子模式仅在递归匹配时才起作用?

时间:2017-11-10 21:01:18

标签: c# .net regex recursion

Link to demo of the Regex.我不明白为什么(?P=name)导致模式不匹配。我不能使用递归,因为我在C#中使用了模式。

1 个答案:

答案 0 :(得分:1)

你的问题是C#Regex不支持子程序,这是^ +<tr class="clickable" data-id="(?<AccountID>[^"]+)" data-jobid=\"(?<JobID>[^\"]+)\"(?:(?:<\/td)?>[^>]+>)(?<InvoiceID>[^<]+)(?:(?:<\/td)?>[^>]+>)(?<Date>[^ ]+)\n +(?:(?:<\/td)?>[^>]+>)(?<Status>[^<]+)(?:(?:<\/td)?>[^>]+>)(?<Type>[^<]+)(?:(?:<\/td)?>[^>]+>)(?<Total>[^<]+)(?:(?:<\/td)?>[^>]+>)(?<Balance>[^<]+)(?:(?:<\/td)?>[^>]+>)(?<Paid>[^<]+)(?:(?:<\/td)?>[^>]+>)(?<Technician>[^<]+)(?:(?:<\/td)?>[^>]+>) 创建的。你也不能使用反向引用,因为Row值不相等,你只需要插入子程序内联并重复它:

{{1}}