fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var s = "lat range: 49.000000 to 50.000000 actual lat 49.212059 lon range: 16.000000 to 17.000000 actual lon 16.626276";
  10. var pattern = @"actual (?<type>lat|lon) (?<val>\d+\.\d{1,6})|(?<val>\d+\.\d{1,6}) (?<type>lat|lon)";
  11. var results = Regex.Matches(s, pattern)
  12. .Cast<Match>()
  13. .ToDictionary(
  14. m => m.Groups["type"].Value,
  15. m => m.Groups["val"].Value);
  16. foreach (var kv in results)
  17. Console.WriteLine("'{0}': '{1}'", kv.Key, kv.Value);
  18. }
  19. }
Success #stdin #stdout 0.03s 133824KB
stdin
Standard input is empty
stdout
'lat': '49.212059'
'lon': '16.626276'