Group Capture with File.Replace

Jun 16, 2010 at 7:56 PM
Edited Jun 16, 2010 at 7:58 PM
Regular expressions in .NET can capture sub-matches for later use. For example:

String s = "My phone number is 800-342-9987."
Match m = RegEx.Match("(\d+)-(\d+)-(\d+)", s);
// m.Groups(1) contains "800"
// m.Groups(2) contains "342"
// m.Groups(3) contains "9987"

Is it possible to take advantage of this using something like:

<!-- remove hyphens from phone number" -->
<MSBuild.ExtensionPack.FileSystem.File TaskAction="Replace"

The documentation of Replacement in the help file is, shall we say, minimal.

- Brian
Jun 17, 2010 at 8:26 AM

Hi Brian

I don't believe this is supported at the moment. Certainly something which can be looked at for a future release. I'll add it as a workitem to track.


Jun 17, 2010 at 8:27 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 17, 2010 at 4:46 PM
Thanks Mike. - Brian