Posted By

qrist0ph on 09/09/10


Tagged

regexp


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Regular Expressions in C#


 / Published in: C#
 

  1. Regex RE = new Regex(@"\\\\(?<TheServer>\w*)\\(?<TheService>\w*)\\", RegexOptions.Multiline);
  2. MatchCollection theMatches = RE.Matches(@"Path = ""\\MyServer\MyService\MyPath;
  3. \\MyServer2\MyService2\MyPath2\""");
  4. foreach (Match m in theMatches)
  5. {
  6. for (int counter = 0;counter < m.Groups.Count; counter++)
  7. {
  8. string ss = RE.GroupNameFromNumber(counter);
  9. Group g = m.Groups[counter];
  10. string s = g.ToString();
  11. }
  12. }

Report this snippet  

You need to login to post a comment.