fork(33) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4. using System.Linq;
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var pat = @"\[(?<first>[-\d.]+)\s*,\s*(?<second>[-\d.]+)]";
  10. var s = "1: ([37.788353, -122.387695], [37.829853, -122.294312]) 2: ([37.429615, -122.087631], [37.487391, -122.018967]) 3: ([37.474858, -122.131577], [37.529332, -122.056046]) 4: ([37.532599,-122.218094], [37.615863,-122.097244]) 5: ([37.516262,-122.198181], [37.653383,-122.151489]) 6: ([37.504824,-122.181702], [37.633266,-122.121964])";
  11. var res = Regex.Matches(s, pat).Cast<Match>().Select(m => new[] { m.Groups["first"].Value, m.Groups["second"].Value } );
  12. foreach (var str in res)
  13. {
  14. Console.WriteLine("[{0}, {1}]", str[0], str[1]);
  15. }
  16. }
  17. }
Success #stdin #stdout 0.04s 134720KB
stdin
Standard input is empty
stdout
[37.788353, -122.387695]
[37.829853, -122.294312]
[37.429615, -122.087631]
[37.487391, -122.018967]
[37.474858, -122.131577]
[37.529332, -122.056046]
[37.532599, -122.218094]
[37.615863, -122.097244]
[37.516262, -122.198181]
[37.653383, -122.151489]
[37.504824, -122.181702]
[37.633266, -122.121964]