Skip to content

Instantly share code, notes, and snippets.

@jonpryor
Created January 15, 2013 17:26
Show Gist options
  • Save jonpryor/4540294 to your computer and use it in GitHub Desktop.
Save jonpryor/4540294 to your computer and use it in GitHub Desktop.
$ csharp
using SyMono C# Shell, type "help;" for help
Enter statements below.
csharp> using System.Text.RegularExpressions;
csharp> var r = new Regex (@"^\s*(?<name>[A-Za-z0-9_]+)\s*=\s*(?<value>[^\s]+)\s*;");
csharp> var m = r.Match ("Foo = Bar;");
csharp> m.Success;
true
csharp> var name = m.Groups ["name"].Value;
csharp> name;
"Foo"
csharp> var value = m.Groups ["value"].Value;
csharp> value;
"Bar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment