Why don't named captures work in regular expressions? For example, in the following expression:
<(?<Address>(\w\d)),(?<Transaction>\d+),(?<Verb>[A-Za-z]\w+)(=((?<NumericPayload>\d+)|(?<TextPayload>.+)))?>
This should produce named captures named "Address", "Transaction", "Verb" and so on. This works in desktop applications, but in a .NetMF app it produces an error RegexpSyntaxException: Mising operand to closure.
Oddly, the Match class has all the members needed to retrieve matched groups, as in this code which compiles correctly:
var deviceAddress = matches.Groups["Address"].Value; var transaction = int.Parse(matches.Groups["Transaction"].Value); var verb = matches.Groups["Verb"].Value;
So on that basis it seems odd that the regular expression parser appears to not support named captures - a great shame because it make using regular expressions much 'cleaner' and somewhat self-documenting.
I can't find any statements on what is and isn't supported in regular expressions in NetMF, so on the face of it this would appear to be a bug, either in the code or the documentation.
Any comments?
--Tim Long