Skip to content

Instantly share code, notes, and snippets.

@dgfitch
Created January 24, 2011 17:09
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 dgfitch/793536 to your computer and use it in GitHub Desktop.
Save dgfitch/793536 to your computer and use it in GitHub Desktop.
let (|Matches|_|) pattern input =
let matches = Regex.Matches(input, pattern)
if matches.Count > 0 then Some [ for m in matches -> m ] else None
let (|MatchesR|_|) (regex:Regex) input =
let matches = regex.Matches input
if matches.Count > 0 then Some [ for m in matches -> m ] else None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment