Skip to content

Instantly share code, notes, and snippets.

@mneedham
Created July 7, 2009 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mneedham/142063 to your computer and use it in GitHub Desktop.
Save mneedham/142063 to your computer and use it in GitHub Desktop.
let ExtractValues1 (item:string) =
let matchBuildDuration item = Regex.Match(item, "(.*\)),([0-9]+),")
Regex.Split(item, "\n") |>
Array.map (fun item ->
let m = matchBuildDuration item
if(m.Success)
then { Agent = m.Groups.[1].Value; Duration = m.Groups.[2].Value }
else { Agent = ""; Duration = ""} ) |>
Array.filter (fun item -> item.Agent <> "" && item.Duration <> "")
let ExtractValues2 (item:string) =
let matchBuildDuration item = Regex.Match(item, "(.*\)),([0-9]+),")
Regex.Split(item, "\n") |>
Array.map (fun item ->
let m = matchBuildDuration item
if(m.Success)
then Some({ Agent = m.Groups.[1].Value; Duration = m.Groups.[2].Value })
else None ) |>
Array.filter (fun item -> item.IsSome)
let ExtractValues3 (response:string) =
let matchBuildDuration item = Regex.Match(item, "(.*\)),([0-9]+),")
Regex.Split(response, "\n") |>
Array.filter (fun x -> (matchBuildDuration x).Success) |>
Array.map (fun x -> (matchBuildDuration x).Groups) |>
Array.map (fun group -> { Agent = (group.[1].Value); Duration = (group.[2].Value) } )
let ExtractValues (response:string) =
Regex.Split(response, "\n") |>
Array.map (fun x -> Regex.Match(x, "(.*\)),([0-9]+),")) |>
Array.filter (fun x -> x.Success) |>
Array.map (fun x -> x.Groups) |>
Array.map (fun group -> { Agent = (group.[1].Value); Duration = (group.[2].Value) } )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment