Link to demo of the Regex. I don't understand why (?P=name)
causes the pattern to not match. I can't use recursion because I'm using the pattern in C#.
Asked
Active
Viewed 90 times
-5

ZJohnsonPest
- 11
- 1
- 3
-
2Welcome to `SO`. Really, this is a no-no. Use a parser instead! – Jan Nov 10 '17 at 21:02
-
[Check out this link](https://stackoverflow.com/a/100393/8195525) – Derek Nov 10 '17 at 21:08
1 Answers
1
Your issue is C# Regex does not support subroutines, which is what (?P(DEFINE)
creates. You also can't use a backreference, as the Row values aren't equal, you just have to insert the subroutine inline and repeat it:
^ +<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)?>[^>]+>)

NetMage
- 26,163
- 3
- 34
- 55