RegEx MatchEvaluator, how to write a oneliner?
I'm working off the help here for examples and struggliong to understand how I can convert it's multiline example into a oneliner. I'm more used to Perl ;-).
Here's some code fro example that works:
string First3(Match M) { return M.Value.Remove(3); } // defined in the class MyClass
MyClass C = new MyClass(); // A class which has a method called First3
MatchEvaluator ME = new MatchEvaluator(C.First3);
string S = Regex.Replace(sMonths, "(January|February|March|April|May|June|July|August|September|October|November|December)", ME);
Now I want to avoid instantiating MyClass. I'm aiming at something more like this:
string S = Regex.Replace(sMonths, "(January|February|March|April|May|June|July|August|September|October|November|December)", new MatchEvaluator(this.Value.Remove(3)));
in short a one-liner. But the semantics of "this" are escaping me here (i.e. this kind of code fails ;-). and I can't see how to identify the argument to the new MatchEvaluator to give it an implicit function return as I'm aiming to achieve.
Am I barking up the wrong tree, is this possible?
If there's an easier way to convert long month names to short I'm open to hearing that too, but all the same I'd like to nuderstand the semantics of MatchEvaluators here and how to write oneliners! That is, I want to solve this particular problem and I want to understand the general case of MatchEvaluators.
Cheers,
Bernd.

