施用 TypeProviders

使用 TypeProviders
使用 TypeProviders

#r @"D:\工具\TypeProviders\packages\FSharpx.TypeProviders.Regex.1.7.4\lib\40\FSharpx.TypeProviders.Regex.dll";;

type T = FSharpx.Regex< @"(?<AreaCode>^\d{3})-(?<PhoneNumber>\d{3}-\d{4}$)">
let reg = T() 
let result = T.IsMatch("425-123-2345")
let r1 = reg.Match("425-123-2345").AreaCode.Value 
let r2 = reg.Match("425-123-2345").PhoneNumber.Value
reg.Match("425-123-2345").Groups.Count
reg.Match("425-123-2345").Groups.[0].Value
reg.Match("425-123-2345").Groups.[1].Value
reg.Match("425-123-2345").Groups.[2].Value
reg.Match("425-123-2345").Groups.[4].Value
reg.GetGroupNumbers().Length
reg.GetGroupNames()