Skip to content

Instantly share code, notes, and snippets.

View AmadorMunozBerzosa's full-sized avatar

AmadorMunozBerzosa

View GitHub Profile
@AmadorMunozBerzosa
AmadorMunozBerzosa / ActivePatterns.fs
Last active June 19, 2021 16:36
DSL wrapper for working with regular expressions in a readable manner in F#. Gist messes with the file ordering, but the correct file order is: Types > Evaluation > Operators > ActivePatterns > Examples
module Krow.Regex.ActivePatterns
open System.Text
let (|Regex|_|) (pattern:IRegex) input =
if input = null then
None
else
try
let match' = RegularExpressions.Regex.Match(input, pattern |> Regex.evaluate)