text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>FsGroup - FsRegEx</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content=""/>
    <meta name="author" content="Jack Fox"/>

    <link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet"/>

    <link type="text/css" rel="stylesheet" href="/FsRegEx/content/style.css" />

fsharp.org

github page

FsRegEx

FsGroup

    Namespace: global

        Parent Module: FsRegEx

Composable wrapping type for System.Text.RegularExpressions.Group.

Constructors

Constructor	Description

            new(name, group)

            Signature: (name:string * group:Group) -> FsGroup

CompiledName: .ctor

Instance members

Instance member	Description

            Captures()

            Signature: unit -> Capture []

Array of all the captures matched by the capturing group, in innermost-leftmost-first order (or innermost-rightmost-first order if the regular expression is modified with the RegexOptions.RightToLeft option). The collection may have zero or more items.

            Group

            Signature: Group

The underlying System.Text.RegularExpressions.Group. Represents the results from a single capturing group.

CompiledName: get_Group

            Index

            Signature: int

The position in the original string where the first character of the captured substring is found.

CompiledName: get_Index

            Length

            Signature: int

Returns the length of the captured substring.

CompiledName: get_Length

            Name

            Signature: string

Returns name of capture group.

CompiledName: get_Name

            Success

            Signature: bool

Returns a value indicating whether the match is successful.

CompiledName: get_Success

            Value

            Signature: string

Returns the captured substring from the input string.

CompiledName: get_Value

FsRegEx

Home page

Get Library via NuGet

Source Code on GitHub

License

Release Notes

Examples

Matching

Match Groups

Replace and Split

Capture

Documentation

API Reference

More...

On the Futility of Email Regex Validation

F# Verbal Expressions Tutorial


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>FsRegEx - FsRegEx</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content=""/>
    <meta name="author" content="Jack Fox"/>

    <link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet"/>

    <link type="text/css" rel="stylesheet" href="/FsRegEx/content/style.css" />

fsharp.org

github page

FsRegEx

FsRegEx

  Namespace: global

Types and functions supporting composable F# regular expressions.

Nested types and modules

Type	Description

            FsGroup

Composable wrapping type for System.Text.RegularExpressions.Group.

            FsMatch

Composable wrapping type for System.Text.RegularExpressions.Match. Represents the results from a single regular expression match.

            FsRegEx

Composable immutable wrapping type for System.Text.RegularExpressions.Regex.

Module	Description

            Unicode

Unicode enumerations

Functions and values

Function or value	Description

            capture (...)

            Signature: regularExpression:string -> groupName:string -> input:string -> string

Match and select groupname value.

            captureGroup (...)

            Signature: regularExpression:string -> groupName:string -> input:string -> FsGroup

Match and select group.

            captureGroupOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> groupName:string -> input:string -> FsGroup

Match and select group with Regex options.

            captureOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> groupName:string -> input:string -> string

Match and select groupname value with Regex options.

            firstMatch regularExpression input

            Signature: regularExpression:string -> input:string -> FsMatch

Searches the specified input string for the first occurrence of the regular expression.

            firstMatchOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> input:string -> FsMatch

Searches the specified input string for the first occurrence of the regular expression with Regex options.

            groupNames regularExpression

            Signature: regularExpression:string -> string array

Returns an array of capturing group names for the regular expression.

            groupNumbers regularExpression

            Signature: regularExpression:string -> int array

Returns an array of capturing group numbers that correspond to group names in an array.

            isMatch regularExpression input

            Signature: regularExpression:string -> input:string -> bool

Indicates whether the regular expression finds a match in the input string.

            isMatchAt (...)

            Signature: regularExpression:string -> startAt:int -> input:string -> bool

Indicates whether the regular expression finds a match in the input string beginning at the specified starting position.

            isMatchAtOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> startAt:int -> input:string -> bool

Indicates whether the regular expression finds a match in the input string beginning at the specified starting position with Regex options.

            isMatchOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> input:string -> bool

Indicates whether the regular expression finds a match in the input string with Regex options.

            matchAt regularExpression startAt input

            Signature: regularExpression:string -> startAt:int -> input:string -> FsMatch

Searches the specified input string for the first occurrence of the regular expression beginning at the specified starting position.

            matchAtFor (...)

            Signature: regularExpression:string -> startAt:int -> length:int -> input:string -> FsMatch

Searches the specified input string for the first occurrence of the FsRegEx beginning at the starting position for the length.

            matchAtForOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> startAt:int -> length:int -> input:string -> FsMatch

Searches the specified input string for the first occurrence of the FsRegEx beginning at the starting position for the length with Regex options.

            matchAtOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> startAt:int -> input:string -> FsMatch

Searches the specified input string for the first occurrence of the regular expression beginning at the specified starting position with Regex options.

            matches regularExpression input

            Signature: regularExpression:string -> input:string -> FsMatch []

Searches the specified input string for all occurrences of a regular expression with Regex options.

            matchesAt (...)

            Signature: regularExpression:string -> startAt:int -> input:string -> FsMatch []

Searches the input string for all occurrence of a regular expression, beginning at the specified starting position.

            matchesAtOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> startAt:int -> input:string -> FsMatch []

Searches the input string for all occurrence of a regular expression, beginning at the specified starting position with Regex options.

            matchesOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> input:string -> FsMatch []

Searches the specified input string for all occurrences of a regular expression.

            replace (...)

            Signature: regularExpression:string -> replacement:string -> input:string -> string

In input string replaces all strings that match regular expression pattern with replacement string.

            replaceByMatch (...)

            Signature: regularExpression:string -> evalutor:MatchEvaluator -> input:string -> string

In input string replaces all strings that match regular expression with string returned by MatchEvaluator delegate.

            replaceByMatchMaxTimes (...)

            Signature: regularExpression:string -> evalutor:MatchEvaluator -> count:int -> input:string -> string

In input string replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate.

            replaceByMatchMaxTimesOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> evalutor:MatchEvaluator -> count:int -> input:string -> string

In input string replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate with Regex options.

            replaceByMatchMaxTimesStartAt (...)

            Signature: regularExpression:string -> evalutor:MatchEvaluator -> count:int -> startAt:int -> input:string -> string

In input string beginning at start at position replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate.

            replaceByMatchMaxTimesStartAtOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> evalutor:MatchEvaluator -> count:int -> startAt:int -> input:string -> string

In input string beginning at start at position replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate with Regex options.

            replaceByMatchOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> evalutor:MatchEvaluator -> input:string -> string

In input string replaces all strings that match regular expression with string returned by MatchEvaluator delegate with Regex options.

            replaceMaxTimes (...)

            Signature: regularExpression:string -> replacement:string -> count:int -> input:string -> string

In input string replaces a specified maximum number of strings that match regular expression with replacement string.

            replaceMaxTimesOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> replacement:string -> count:int -> input:string -> string

In input string replaces a specified maximum number of strings that match regular expression with replacement string with Regex options.

            replaceMaxTimesStartAt (...)

            Signature: regularExpression:string -> replacement:string -> count:int -> startAt:int -> input:string -> string

In input string beginning at start at position replaces a specified maximum number of strings that match regular expression with replacement string.

            replaceMaxTimesStartAtOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> replacement:string -> count:int -> startAt:int -> input:string -> string

In input string beginning at start at position replaces a specified maximum number of strings that match regular expression with replacement string with Regex options.

            split regularExpression input

            Signature: regularExpression:string -> input:string -> string array

Splits input string into an array of substrings at the positions defined by regular expression.

            splitMaxTimes (...)

            Signature: regularExpression:string -> count:int -> input:string -> string array

Splits input string a specified maximum number of times into an array of substrings at the positions defined by regular expression.

            splitMaxTimesOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> count:int -> input:string -> string array

Splits input string a specified maximum number of times into an array of substrings at the positions defined by regular expression with Regex options.

            splitMaxTimesStartAt (...)

            Signature: regularExpression:string -> count:int -> startAt:int -> input:string -> string array

Splits input string, begining at start position, a specified maximum number of times into an array of substrings at the positions defined by regular expression.

            splitMaxTimesStartAtOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> count:int -> startAt:int -> input:string -> string array

Splits input string, begining at start position, a specified maximum number of times into an array of substrings at the positions defined by regular expression with Regex options.

            splitOpt (...)

            Signature: regularExpression:string -> regexOptions:RegexOptions -> input:string -> string array

Splits input string into an array of substrings at the positions defined by regular expression with Regex options.

FsRegEx

Home page

Get Library via NuGet

Source Code on GitHub

License

Release Notes

Examples

Matching

Match Groups

Replace and Split

Capture

Documentation

API Reference

More...

On the Futility of Email Regex Validation

F# Verbal Expressions Tutorial

repo_name: jackfoxy/FsRegEx

repo_language: F#

mime_type: text/plain


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>Unicode - FsRegEx</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content=""/>
    <meta name="author" content="Jack Fox"/>

    <link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet"/>

    <link type="text/css" rel="stylesheet" href="/FsRegEx/content/style.css" />

fsharp.org

github page

FsRegEx

Unicode

  Namespace: global

  Parent Module: FsRegEx

Unicode enumerations

Nested types and modules

Type	Description

            SupportedNamedBlock

Enum .NET Framework named Unicode blocks

            UnicodeGeneralCategory

Enum Unicode defined general categories

FsRegEx

Home page

Get Library via NuGet

Source Code on GitHub

License

Release Notes

Examples

Matching

Match Groups

Replace and Split

Capture

Documentation

API Reference

More...

On the Futility of Email Regex Validation

F# Verbal Expressions Tutorial


text:
### Description

Please provide a succinct description of your issue.

### Repro steps

Please provide the steps required to reproduce the problem

1. Step A

2. Step B

### Expected behavior

Please provide a description of the behavior you expect.

### Actual behavior

Please provide a description of the actual behavior you observe.

### Known workarounds

Please provide a description of any known workarounds.

### Related information

* Operating system
* Branch
* .NET Runtime, CoreCLR or Mono Version
* Performance information, links to performance testing scripts


text:
/// Types and functions supporting composable F# regular expressions.
module FsRegEx

open System
open System.Text.RegularExpressions

///Unicode enumerations
module Unicode =
    ///Enum Unicode defined general categories
    type UnicodeGeneralCategory =
        ///Letter, Uppercase; Lu
        | LetterUppercase
        ///Letter, Lowercase; Ll
        | LetterLowercase
        ///Letter, Titlecase; Lt
        | LetterTitlecase
        ///Letter, Modifier; Lm
        | LetterModifier
        ///Letter, Other; Lo
        | LetterOther
        ///All letter characters. This includes the LetterUppercase, LetterLowercase, LetterTitlecase, LetterModifier, and LetterOther characters; L
        | Letter
        ///Mark, Nonspacing; Mn
        | MarkNonspacing
        ///Mark, Spacing Combining; Mc
        | MarkSpacingCombining
        ///Mark, Enclosing; Me
        | MarkEnclosing
        ///All diacritic marks. This includes the MarkNonspacing, MarkSpacingCombining, and MarkEnclosing categories; M
        | Mark
        ///Number, Decimal Digit; Nd
        | NumberDecimalDigit
        ///Number, Letter; Nl
        | NumberLetter
        ///Number, Other; No
        | NumberOther
        ///All numbers. This includes the Nd, Nl, and No categories; N
        | NumberALL
        ///Punctuation, Connector; Pc
        | PunctuationConnector
        ///Punctuation, Dash; Pd
        | PunctuationDash
        ///Punctuation, Open; Ps
        | PunctuationOpen
        ///Punctuation, Close; Pe
        | PunctuationClose
        ///Punctuation, Initial quote (may behave like Ps or Pe depending on usage); Pi
        | PunctuationInitial
        ///Punctuation, Final quote (may behave like Ps or Pe depending on usage); Pf
        | PunctuationFinal
        ///Punctuation, Other; Po
        | PunctuationOther
        ///All punctuation characters. This includes the PunctuationConnector, PunctuationDash, PunctuationOpen, PunctuationClose, PunctuationInitial, PunctuationFinal, and PunctuationOther categories; P
        | Punctuation
        ///Symbol, Math; Sm
        | SymbolMath
        ///Symbol, Currency; Sc
        | SymbolCurrency
        ///Symbol, Modifier; Sk
        | SymbolModifier
        ///Symbol, Other; So
        | SymbolOther
        ///All symbols. This includes the SymbolMath, SymbolCurrency, SymbolModifier, and SymbolOther categories; S
        | Symbol
        ///Separator, Space; Zs
        | SeparatorSpace
        ///Separator, Line; Zl
        | SeparatorLine
        ///Separator, Paragraph; Zp
        | SeparatorParagraph
        ///All separator characters. This includes the SeparatorSpace, SeparatorLine, and SeparatorLine categories; Z
        | Separator
        ///Other, Control; Cc
        | OtherControl
        ///Other, Format; Cf
        | OtherFormat
        ///Other, Surrogate; Cs
        | OtherSurrogate
        ///Other, Private Use; Co
        | OtherPrivateUse
        ///Other, Not Assigned (no characters have this property); Cn
        | OtherNotAssigned
        ///All control characters. This includes the OtherControl, OtherFormat, OtherSurrogate, OtherPrivateUse, and OtherNotAssigned categories; C
        | ControlAll
        with
        override ToString : unit -> string

    ///Enum .NET Framework named Unicode blocks
    type SupportedNamedBlock =
        ///0000 - 007F
        | IsBasicLatin
        ///0080 - 00FF
        | IsLatin1Supplement
        ///0100 - 017F
        | IsLatinExtendedA
        ///0180 - 024F
        | IsLatinExtendedB
        ///0250 - 02AF
        | IsIPAExtensions
        ///02B0 - 02FF
        | IsSpacingModifierLetters
        ///0300 - 036F
        | IsCombiningDiacriticalMarks
        ///0370 - 03FF
        | IsGreek
        ///0370 - 03FF
        | IsGreekandCoptic
        ///0400 - 04FF
        | IsCyrillic
        ///0500 - 052F
        | IsCyrillicSupplement
        ///0530 - 058F
        | IsArmenian
        ///0590 - 05FF
        | IsHebrew
        ///0600 - 06FF
        | IsArabic
        ///0700 - 074F
        | IsSyriac
        ///0780 - 07BF
        | IsThaana
        ///0900 - 097F
        | IsDevanagari
        ///0980 - 09FF
        | IsBengali
        ///0A00 - 0A7F
        | IsGurmukhi
        ///0A80 - 0AFF
        | IsGujarati
        ///0B00 - 0B7F
        | IsOriya
        ///0B80 - 0BFF
        | IsTamil
        ///0C00 - 0C7F
        | IsTelugu
        ///0C80 - 0CFF
        | IsKannada
        ///0D00 - 0D7F
        | IsMalayalam
        ///0D80 - 0DFF
        | IsSinhala
        ///0E00 - 0E7F
        | IsThai
        ///0E80 - 0EFF
        | IsLao
        ///0F00 - 0FFF
        | IsTibetan
        ///1000 - 109F
        | IsMyanmar
        ///10A0 - 10FF
        | IsGeorgian
        ///1100 - 11FF
        | IsHangulJamo
        ///1200 - 137F
        | IsEthiopic
        ///13A0 - 13FF
        | IsCherokee
        ///1400 - 167F
        | IsUnifiedCanadianAboriginalSyllabics
        ///1680 - 169F
        | IsOgham
        ///16A0 - 16FF
        | IsRunic
        ///1700 - 171F
        | IsTagalog
        ///1720 - 173F
        | IsHanunoo
        ///1740 - 175F
        | IsBuhid
        ///1760 - 177F
        | IsTagbanwa
        ///1780 - 17FF
        | IsKhmer
        ///1800 - 18AF
        | IsMongolian
        ///1900 - 194F
        | IsLimbu
        ///1950 - 197F
        | IsTaiLe
        ///19E0 - 19FF
        | IsKhmerSymbols
        ///1D00 - 1D7F
        | IsPhoneticExtensions
        ///1E00 - 1EFF
        | IsLatinExtendedAdditional
        ///1F00 - 1FFF
        | IsGreekExtended
        ///2000 - 206F
        | IsGeneralPunctuation
        ///2070 - 209F
        | IsSuperscriptsandSubscripts
        ///20A0 - 20CF
        | IsCurrencySymbols
        ///20D0 - 20FF
        | IsCombiningDiacriticalMarksforSymbols
        ///20D0 - 20FF
        | IsCombiningMarksforSymbols
        ///2100 - 214F
        | IsLetterlikeSymbols
        ///2150 - 218F
        | IsNumberForms
        ///2190 - 21FF
        | IsArrows
        ///2200 - 22FF
        | IsMathematicalOperators
        ///2300 - 23FF
        | IsMiscellaneousTechnical
        ///2400 - 243F
        | IsControlPictures
        ///2440 - 245F
        | IsOpticalCharacterRecognition
        ///2460 - 24FF
        | IsEnclosedAlphanumerics
        ///2500 - 257F
        | IsBoxDrawing
        ///2580 - 259F
        | IsBlockElements
        ///25A0 - 25FF
        | IsGeometricShapes
        ///2600 - 26FF
        | IsMiscellaneousSymbols
        ///2700 - 27BF
        | IsDingbats
        ///27C0 - 27EF
        | IsMiscellaneousMathematicalSymbolsA
        ///27F0 - 27FF
        | IsSupplementalArrowsA
        ///2800 - 28FF
        | IsBraillePatterns
        ///2900 - 297F
        | IsSupplementalArrowsB
        ///2980 - 29FF
        | IsMiscellaneousMathematicalSymbolsB
        ///2A00 - 2AFF
        | IsSupplementalMathematicalOperators
        ///2B00 - 2BFF
        | IsMiscellaneousSymbolsandArrows
        ///2E80 - 2EFF
        | IsCJKRadicalsSupplement
        ///2F00 - 2FDF
        | IsKangxiRadicals
        ///2FF0 - 2FFF
        | IsIdeographicDescriptionCharacters
        ///3000 - 303F
        | IsCJKSymbolsandPunctuation
        ///3040 - 309F
        | IsHiragana
        ///30A0 - 30FF
        | IsKatakana
        ///3100 - 312F
        | IsBopomofo
        ///3130 - 318F
        | IsHangulCompatibilityJamo
        ///3190 - 319F
        | IsKanbun
        ///31A0 - 31BF
        | IsBopomofoExtended
        ///31F0 - 31FF
        | IsKatakanaPhoneticExtensions
        ///3200 - 32FF
        | IsEnclosedCJKLettersandMonths
        ///3300 - 33FF
        | IsCJKCompatibility
        ///3400 - 4DBF
        | IsCJKUnifiedIdeographsExtensionA
        ///4DC0 - 4DFF
        | IsYijingHexagramSymbols
        ///4E00 - 9FFF
        | IsCJKUnifiedIdeographs
        ///A000 - A48F
        | IsYiSyllables
        ///A490 - A4CF
        | IsYiRadicals
        ///AC00 - D7AF
        | IsHangulSyllables
        ///D800 - DB7F
        | IsHighSurrogates
        ///DB80 - DBFF
        | IsHighPrivateUseSurrogates
        ///DC00 - DFFF
        | IsLowSurrogates
        ///E000 - F8FF
        | IsPrivateUse
        ///F900 - FAFF
        | IsCJKCompatibilityIdeographs
        ///FB00 - FB4F
        | IsAlphabeticPresentationForms
        ///FB50 - FDFF
        | IsArabicPresentationFormsA
        ///FE00 - FE0F
        | IsVariationSelectors
        ///FE20 - FE2F
        | IsCombiningHalfMarks
        ///FE30 - FE4F
        | IsCJKCompatibilityForms
        ///FE50 - FE6F
        | IsSmallFormVariants
        ///FE70 - FEFF
        | IsArabicPresentationFormsB
        ///FF00 - FFEF
        | IsHalfwidthandFullwidthForms
        ///FFF0 - FFFF
        | IsSpecials
        with
        override ToString : unit -> string

///Composable wrapping type for System.Text.RegularExpressions.Group.
type FsGroup =
  class
    new : name:string * group:Group -> FsGroup
    ///Array of all the captures matched by the capturing group, in innermost-leftmost-first order (or innermost-rightmost-first order if the regular expression is modified with the RegexOptions.RightToLeft option). The collection may have zero or more items.
    member Captures : unit -> Capture []
    override Equals : yobj:obj -> bool
    override GetHashCode : unit -> int
    override ToString : unit -> string
    ///The underlying System.Text.RegularExpressions.Group. Represents the results from a single capturing group.
    member Group : System.Text.RegularExpressions.Group
    ///The position in the original string where the first character of the captured substring is found.
    member Index : int
    ///Returns the length of the captured substring.
    member Length : int
    ///Returns name of capture group.
    member Name : string
    ///Returns a value indicating whether the match is successful.
    member Success : bool
    ///Returns the captured substring from the input string.
    member Value : string
  end

///Composable wrapping type for System.Text.RegularExpressions.Match. Represents the results from a single regular expression match.
type FsMatch =
  class
    new : regex:Regex * fsMatch:Match -> FsMatch
    ///Array of all the captures matched by the capturing group, in innermost-leftmost-first order (or innermost-rightmost-first order if the regular expression is modified with the RegexOptions.RightToLeft option). The collection may have zero or more items.
    member Captures : unit -> Capture []
    override Equals : yobj:obj -> bool
    override GetHashCode : unit -> int
    /// Capturing groups matched by regular expression.
    member Groups : unit -> FsGroup []
    ///Returns the expansion of the specified replacement pattern.
    member Result : replacement:string -> string
    override ToString : unit -> string
    ///The position in the original string where the first character of the captured substring is found.
    member Index : int
    ///Returns the length of the captured substring.
    member Length : int
    ///Wrapped System.Text.RegularExpressions.Match. Represents the results from a single regular expression match.
    member Match : Match
    ///Returns a value indicating whether the match is successful.
    member Success : bool
    ///Returns the captured substring from the input string.
    member Value : string
  end

///Composable immutable wrapping type for System.Text.RegularExpressions.Regex.
type FsRegEx =
    new : unit -> FsRegEx
    new : regexOptions : RegexOptions -> FsRegEx
    new : regularExpression : string -> FsRegEx
    new : regularExpression : string * regexOptions : RegexOptions -> FsRegEx
    new : regularExpression : string * regexOptions : RegexOptions * matchTimeout : TimeSpan -> FsRegEx

    ///Match and select groupname value.
    member Capture : input : string -> string -> string

    member internal Clone : regexOptions : RegexOptions option -> FsRegEx
    member internal Prefixes : string with get, set
    member internal Source : string with get, set
    member internal Suffixes : string with get, set

    ///Gets the group name that corresponds to the specified group number.
    member GroupNameFromNumber : n : int -> string option

    ///Returns an array of capturing group names for the regular expression.
    member GroupNames : unit -> array<string>

    ///Returns the group number that corresponds to the specified group name.
    member GroupNumberFromName : groupName : string -> int option

    ///Returns an array of capturing group numbers that correspond to group names in an array.
    member GroupNumbers : unit -> array<int>

    ///Indicates whether the regular expression finds a match in the input string.
    member IsMatch : input : string -> bool

    ///Indicates whether the regular expression finds a match in the input string beginning at the specified starting position.
    member IsMatch : input : string * startAt : int -> bool

    ///Searches the specified input string for the first occurrence of the regular expression.
    member Match : input : string -> FsMatch

    ///Searches the specified input string for the first occurrence of the regular expression beginning at the specified starting position.
    member Match : input : string * startAt : int -> FsMatch

    ///Searches the specified input string for the first occurrence of the regular expression beginning at the starting position for the length.
    member Match : input : string * startAt : int * length : int -> FsMatch

    ///Searches the specified input string for all occurrences of a regular expression.
    member Matches : input : string -> FsMatch[]

    ///Searches the input string for the first occurrence of a regular expression, beginning at the specified starting position.
    member Matches : input : string * startAt : int -> FsMatch[]

    ///Gets the time-out interval of the current instance.
    member MatchTimeout : TimeSpan

    ///The underlying System.Text.RegularExpressions.Regex
    member Regex : Regex

    ///Enumerated values to use to set regular expression options.
    member RegexOptions : RegexOptions

    ///In input string replaces all strings that match regular expression pattern with replacement string.
    member Replace : input : string * replacement : string -> string

    ///In input string replaces all strings that match regular expression with string returned by MatchEvaluator delegate.
    member Replace : input : string * evalutor : MatchEvaluator -> string

    ///In input string replaces a specified maximum number of strings that match regular expression with replacement string.
    member Replace : input : string * replacement : string * count : int -> string

    ///In input string replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate.
    member Replace : input : string * evalutor : MatchEvaluator * count : int -> string

    ///In input string beginning at start at position replaces a specified maximum number of strings that match regular expression with replacement string.
    member Replace : input : string * replacement : string * count : int * startAt : int -> string

    ///In input string beginning at start at position replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate.
    member Replace : input : string * evalutor : MatchEvaluator * count : int * startAt : int -> string

    ///Indicates whether the regular expression searches from right to left.
    member RightToLeft : bool

    ///Splits input string into an array of substrings at the positions defined by regular expression.
    member Split : input : string -> array<string>

    ///Splits input string a specified maximum number of times into an array of substrings at the positions defined by regular expression.
    member Split : input : string * count : int -> array<string>

    ///Splits input string, begining at start position, a specified maximum number of times into an array of substrings at the positions defined by regular expression.
    member Split : input : string * count : int * startAt : int -> array<string>

///Searches the specified input string for the first occurrence of the regular expression.
val firstMatch : regularExpression : string -> input : string -> FsMatch

///Searches the specified input string for the first occurrence of the regular expression with Regex options.
val firstMatchOpt : regularExpression : string -> regexOptions : RegexOptions -> input : string -> FsMatch

///Searches the specified input string for the first occurrence of the regular expression beginning at the specified starting position.
val matchAt : regularExpression : string -> startAt : int -> input : string -> FsMatch

///Searches the specified input string for the first occurrence of the regular expression beginning at the specified starting position with Regex options.
val matchAtOpt : regularExpression : string -> regexOptions : RegexOptions -> startAt : int -> input : string -> FsMatch

///Searches the specified input string for the first occurrence of the FsRegEx beginning at the starting position for the length.
val matchAtFor : regularExpression : string -> startAt : int ->  length : int -> input : string -> FsMatch

///Searches the specified input string for the first occurrence of the FsRegEx beginning at the starting position for the length with Regex options.
val matchAtForOpt : regularExpression : string -> regexOptions : RegexOptions -> startAt : int ->  length : int -> input : string -> FsMatch

///Searches the specified input string for all occurrences of a regular expression with Regex options.
val matches : regularExpression : string -> input : string -> FsMatch[]

///Searches the specified input string for all occurrences of a regular expression.
val matchesOpt : regularExpression : string -> regexOptions : RegexOptions -> input : string -> FsMatch[]

///Searches the input string for all occurrence of a regular expression, beginning at the specified starting position.
val matchesAt : regularExpression : string -> startAt : int -> input : string -> FsMatch[]

///Searches the input string for all occurrence of a regular expression, beginning at the specified starting position with Regex options.
val matchesAtOpt : regularExpression : string -> regexOptions : RegexOptions -> startAt : int -> input : string -> FsMatch[]

///In input string replaces all strings that match regular expression pattern with replacement string.
val replace : regularExpression : string -> replacement : string -> input : string -> string

///In input string replaces all strings that match regular expression with string returned by MatchEvaluator delegate.
val replaceByMatch : regularExpression : string -> evalutor : MatchEvaluator -> input : string -> string

///In input string replaces all strings that match regular expression with string returned by MatchEvaluator delegate with Regex options.
val replaceByMatchOpt : regularExpression : string -> regexOptions : RegexOptions -> evalutor : MatchEvaluator -> input : string -> string

///In input string replaces a specified maximum number of strings that match regular expression with replacement string.
val replaceMaxTimes : regularExpression : string -> replacement : string -> count : int -> input : string -> string

///In input string replaces a specified maximum number of strings that match regular expression with replacement string with Regex options.
val replaceMaxTimesOpt : regularExpression : string -> regexOptions : RegexOptions -> replacement : string -> count : int -> input : string -> string

///In input string replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate.
val replaceByMatchMaxTimes : regularExpression : string -> evalutor : MatchEvaluator -> count : int -> input : string -> string

///In input string replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate with Regex options.
val replaceByMatchMaxTimesOpt : regularExpression : string -> regexOptions : RegexOptions -> evalutor : MatchEvaluator -> count : int -> input : string -> string

///In input string beginning at start at position replaces a specified maximum number of strings that match regular expression with replacement string.
val replaceMaxTimesStartAt : regularExpression : string -> replacement : string -> count : int -> startAt : int -> input : string -> string

///In input string beginning at start at position replaces a specified maximum number of strings that match regular expression with replacement string with Regex options.
val replaceMaxTimesStartAtOpt : regularExpression : string -> regexOptions : RegexOptions -> replacement : string -> count : int -> startAt : int -> input : string -> string

///In input string beginning at start at position replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate.
val replaceByMatchMaxTimesStartAt : regularExpression : string -> evalutor : MatchEvaluator -> count : int -> startAt : int -> input : string -> string

///In input string beginning at start at position replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate with Regex options.
val replaceByMatchMaxTimesStartAtOpt : regularExpression : string -> regexOptions : RegexOptions -> evalutor : MatchEvaluator -> count : int -> startAt : int -> input : string -> string

///Splits input string into an array of substrings at the positions defined by regular expression.
val split : regularExpression : string -> input : string -> array<string>

///Splits input string into an array of substrings at the positions defined by regular expression with Regex options.
val splitOpt : regularExpression : string -> regexOptions : RegexOptions -> input : string -> array<string>

///Splits input string a specified maximum number of times into an array of substrings at the positions defined by regular expression.
val splitMaxTimes : regularExpression : string -> count : int -> input : string -> array<string>

///Splits input string a specified maximum number of times into an array of substrings at the positions defined by regular expression with Regex options.
val splitMaxTimesOpt : regularExpression : string -> regexOptions : RegexOptions -> count : int -> input : string -> array<string>

///Splits input string, begining at start position, a specified maximum number of times into an array of substrings at the positions defined by regular expression.
val splitMaxTimesStartAt : regularExpression : string -> count : int -> startAt : int -> input : string -> array<string>

///Splits input string, begining at start position, a specified maximum number of times into an array of substrings at the positions defined by regular expression with Regex options.
val splitMaxTimesStartAtOpt : regularExpression : string -> regexOptions : RegexOptions -> count : int -> startAt : int -> input : string -> array<string>

///Match and select groupname value.
val capture : regularExpression : string  -> groupName : string -> input : string -> string

///Match and select groupname value with Regex options.
val captureOpt : regularExpression : string  -> regexOptions : RegexOptions -> groupName : string -> input : string -> string

///Match and select group.
val captureGroup : regularExpression : string -> groupName : string -> input : string -> FsGroup

///Match and select group with Regex options.
val captureGroupOpt : regularExpression : string -> regexOptions : RegexOptions -> groupName : string -> input : string -> FsGroup

///Returns an array of capturing group names for the regular expression.
val groupNames : regularExpression : string -> array<string>

///Returns an array of capturing group numbers that correspond to group names in an array.
val groupNumbers : regularExpression : string -> array<int>

///Indicates whether the regular expression finds a match in the input string.
val isMatch : regularExpression : string  -> input : string -> bool

///Indicates whether the regular expression finds a match in the input string with Regex options.
val isMatchOpt : regularExpression : string  -> regexOptions : RegexOptions -> input : string -> bool

///Indicates whether the regular expression finds a match in the input string beginning at the specified starting position.
val isMatchAt : regularExpression : string -> startAt : int -> input : string -> bool

///Indicates whether the regular expression finds a match in the input string beginning at the specified starting position with Regex options.
val isMatchAtOpt : regularExpression : string -> regexOptions : RegexOptions -> startAt : int -> input : string -> bool


text:
type file
id FsRegEx
title
    FsRegEx
owners
    Jack Fox
authors
    Jack Fox
projectUrl
    https://jackfoxy.github.io/FsRegEx/
iconUrl
    https://raw.githubusercontent.com/jackfoxy/FsRegEx/master/docs/img/logo.png
licenseUrl
    https://github.com/jackfoxy/FsRegEx/blob/master/LICENSE.txt
requireLicenseAcceptance
    false
language
    F#
copyright
    Copyright 2018
tags
    F# fsharp regularexpression regularexpressions
summary
    Composable F# regular expressions.
description
    FsRegEx provides composable F# functionality for all the capabilities of the .NET Regex class including supporting pipe forward |> composability.

files
	../../bin/FsRegEx ==> lib


text:
///Common regular expressions in FsRegEx type.
module CommonFsRegEx

open FsRegEx

///Valid email string. (Note that RE email validation is ill-advised.)
val Email : FsRegEx

///Valid Url string.
val Url : FsRegEx


text:
module VerbalExpressions

open FsRegEx
open System.Text.RegularExpressions

let firstMatch input (fsRegEx : FsRegEx) =
    fsRegEx .Match input

let matchAt input startAt (fsRegEx : FsRegEx) =
    fsRegEx .Match (input, startAt)

let matches input (fsRegEx : FsRegEx) =
    fsRegEx .Matches input

let matchesAt input startAt (fsRegEx : FsRegEx) =
    fsRegEx .Matches (input, startAt)

let matchAtFor input startAt length (fsRegEx : FsRegEx) =
    fsRegEx .Match (input, startAt, length)

let replace input (replacement : string) (fsRegEx : FsRegEx) =
    fsRegEx .Replace(input, replacement)

let replaceByMatch input (evalutor : MatchEvaluator) (fsRegEx : FsRegEx) =
    fsRegEx .Replace(input, evalutor)

let replaceMaxTimes input (replacement : string) count (fsRegEx : FsRegEx) =
    fsRegEx .Replace(input, replacement, count )

let replaceByMatchMaxTimes input (evalutor : MatchEvaluator) count (fsRegEx : FsRegEx) =
    fsRegEx .Replace(input, evalutor, count)

let replaceMaxTimesStartAt input (replacement : string) count startAt (fsRegEx : FsRegEx) =
    fsRegEx .Replace(input, replacement, count, startAt)

let replaceByMatchMaxTimesStartAt input (evalutor : MatchEvaluator) count startAt (fsRegEx : FsRegEx) =
    fsRegEx .Replace(input, evalutor, count, startAt)

let split input (fsRegEx : FsRegEx) =
    fsRegEx .Split input

let splitMaxTimes input count (fsRegEx : FsRegEx) =
    fsRegEx .Split (input, count)

let splitMaxTimesStartAt input count startAt (fsRegEx : FsRegEx) =
    fsRegEx .Split (input, count, startAt)

let resetRegexOptions regexOptions (fsRegEx : FsRegEx) =
    fsRegEx .Clone regexOptions

let capture input groupName (fsRegEx : FsRegEx) =
    fsRegEx .Capture input groupName

let groupNames (fsRegEx : FsRegEx) =
    fsRegEx .GroupNames()

let groupNumbers (fsRegEx : FsRegEx) =
    fsRegEx .GroupNumbers()

let isMatch value (fsRegEx : FsRegEx) =
    fsRegEx .IsMatch value

let isMatchAt value startAt (fsRegEx : FsRegEx) =
    fsRegEx .IsMatch (value, startAt)

let toString (fsRegEx : FsRegEx) =
    fsRegEx .ToString()

let startOfLine (fsRegEx : FsRegEx) =
    let v = fsRegEx .Clone None
    if v.Prefixes.StartsWith("^") then v
    else
        v.Prefixes <- "^" + v.Prefixes
        v

let endOfLine (fsRegEx : FsRegEx) =
    let v = fsRegEx .Clone None
    if v.Suffixes.EndsWith("$") then v
    else
        v.Suffixes <- v.Suffixes + "$"
        v

let add value (fsRegEx : FsRegEx) =
    let v = fsRegEx .Clone None
    v.Source <- v.Source + value
    v

let internalAdd (fsRegEx : FsRegEx) value =
    let v = fsRegEx .Clone None
    v.Source <- v.Source + value
    v

let then' value (fsRegEx : FsRegEx) =
    Regex.Escape value
    |> sprintf "(%s)"
    |> internalAdd fsRegEx

let find value (fsRegEx : FsRegEx) = then' value fsRegEx

let maybe value (fsRegEx : FsRegEx) =
    Regex.Escape value
    |> sprintf "(%s)?"
    |> internalAdd fsRegEx

let anything (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  "(.*)"

let anythingBut value (fsRegEx : FsRegEx) =
    Regex.Escape value
    |> sprintf "([^%s]*)"
    |> internalAdd fsRegEx

let something (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  "(.+)"

let somethingBut value (fsRegEx : FsRegEx) =
    Regex.Escape value
    |> sprintf "([^%s]+)"
    |> internalAdd fsRegEx

let lineBreak (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"(\n|(\r\n))"

let br (fsRegEx : FsRegEx) = lineBreak fsRegEx

let tab (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"\t"

let whiteSpace (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"\s"

let nonWhiteSpace (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"\S"

let word (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"\w+"

let wordCharacter (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"\w"

let nonWordCharacter (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"\W"

let digit (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"\d"

let nonDigit (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  @"\D"

let backReference ordinal (fsRegEx : FsRegEx) =
    if ordinal < 1 then invalidArg "ordinal" "must be greater than 0"

    sprintf @"\%i" ordinal
    |> internalAdd fsRegEx

let namedBackReference name (fsRegEx : FsRegEx) =
    sprintf @"\k<%s>" name
    |> internalAdd fsRegEx

let anyOf value (fsRegEx : FsRegEx) =
    Regex.Escape value
    |> sprintf "[%s]"
    |> internalAdd fsRegEx

let any value (fsRegEx : FsRegEx) = anyOf value fsRegEx

let range (collection : seq<obj>) (fsRegEx : FsRegEx) =

    let elem =
        collection
        |> Seq.fold (fun s t ->
            let x = t.ToString()
            if x.Length = 0 then s
            else Regex.Escape(x)::s) []
        |> List.rev

    let divisor =
        if elem.Length % 2 = 0 then
            elem.Length / 2
        else
            elem.Length / 2 + 1

    List.splitInto divisor elem
    |> List.fold (fun (s : string) t ->
        if t.Length = 1 then
            if s.Length = 0 then
                invalidArg "range" "one-element range"
            else
                s + "|" + t.Head
        else
            s + ("[" + t.Head + "-" + t.Tail.Head + "]") ) ""
    |> internalAdd fsRegEx

let multiple value (fsRegEx : FsRegEx) =
    Regex.Escape value
    |> sprintf @"(%s)+"
    |> internalAdd fsRegEx

let multipleFsRegEx (sourceFsRegEx : FsRegEx) (fsRegEx : FsRegEx) =
    sourceFsRegEx.ToString()
    |> sprintf @"(%s)+"
    |> internalAdd fsRegEx

let or' value (fsRegEx : FsRegEx) =
    let v = fsRegEx .Clone None
    if v.Source.EndsWith("(") || v.Source.EndsWith(">") then //begin capture
        v.Source <- v.Source + value
    else
        if v.Prefixes.Length > 0 || v.Source.Length > 0 then
            v.Source <- v.Source + "|" + value
        else
            v.Source <- value
    v

let fsRegExOrFsRegEx regexOptions (fsRegEx : FsRegEx) (fsRegEx2 : FsRegEx) =
    let v = fsRegEx .Clone (Some regexOptions)
    v.Prefixes <- v.Prefixes + "("
    v.Source <- v.Source + ")|(" + fsRegEx2.ToString()
    v.Suffixes <- ")" + v.Suffixes
    v

let beginCapture (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  "("

let beginCaptureNamed groupName (fsRegEx : FsRegEx) =
    Regex.Escape groupName
    |> sprintf "(?<%s>"
    |> internalAdd fsRegEx

let endCapture (fsRegEx : FsRegEx) =
    internalAdd fsRegEx  ")"

let repeatPrevious n (fsRegEx : FsRegEx) =

    if n < 1 then
        invalidArg "repeatPrevious" "must be greater than 0"

    sprintf "{%i}" n
    |> internalAdd fsRegEx

let repeatBetweenPrevious n m (fsRegEx : FsRegEx) =

    if n < 1 then
        invalidArg "repeatBetweenPrevious" "must be greater than 0"

    if n >= m then
        invalidArg "repeatBetweenPrevious" "m must be greater than n"

    sprintf "{%i,%i}" n m
    |> internalAdd fsRegEx

let unicode  nnnn (fsRegEx : FsRegEx) =

    sprintf "\u%s" nnnn
    |> internalAdd fsRegEx

let unicodeCategory (category : Unicode.UnicodeGeneralCategory) (fsRegEx : FsRegEx) =

    category.ToString()
    |> sprintf "\p{%s}"
    |> internalAdd fsRegEx

let notUnicodeCategory (category : Unicode.UnicodeGeneralCategory) (fsRegEx : FsRegEx) =

    category.ToString()
    |> sprintf "\P{%s}"
    |> internalAdd fsRegEx

let namedBlock (name : Unicode.SupportedNamedBlock) (fsRegEx : FsRegEx) =

    name.ToString()
    |> sprintf "\p{%s}"
    |> internalAdd fsRegEx

let notNamedBlock (name : Unicode.SupportedNamedBlock) (fsRegEx : FsRegEx) =

    name.ToString()
    |> sprintf "\P{%s}"
    |> internalAdd fsRegEx

let iter (f : (FsRegEx -> unit)) (fsRegEx : FsRegEx)  : unit = f fsRegEx

let map (f : (FsRegEx -> FsRegEx)) fsRegEx  = f fsRegEx

let fold (f : ('State -> FsRegEx -> 'State)) state fsRegEx  = f state fsRegEx

let foldBack (f : (FsRegEx -> 'State -> 'State)) fsRegEx  state = f fsRegEx  state

let exists (f : (FsRegEx -> bool)) fsRegEx  = f fsRegEx


text:
// Auto-Generated by FAKE; do not edit
namespace System
open System.Reflection

[<assembly: AssemblyTitleAttribute("FsRegEx")>]
[<assembly: AssemblyProductAttribute("FsRegEx")>]
[<assembly: AssemblyDescriptionAttribute("Composable F# regular expressions.")>]
[<assembly: AssemblyVersionAttribute("0.7.2")>]
[<assembly: AssemblyFileVersionAttribute("0.7.2")>]
[<assembly: AssemblyConfigurationAttribute("Release")>]
do ()

module internal AssemblyVersionInformation =
    let [<Literal>] AssemblyTitle = "FsRegEx"
    let [<Literal>] AssemblyProduct = "FsRegEx"
    let [<Literal>] AssemblyDescription = "Composable F# regular expressions."
    let [<Literal>] AssemblyVersion = "0.7.2"
    let [<Literal>] AssemblyFileVersion = "0.7.2"
    let [<Literal>] AssemblyConfiguration = "Release"


text:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
    <RootNamespace>FsRegEx</RootNamespace>
    <AssemblyName>FsRegEx</AssemblyName>
    <Name>FsRegEx</Name>
    <OutputType>Library</OutputType>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <!-- Optional: Declare that the Repository URL can be published to NuSpec -->
    <PublishRepositoryUrl>true</PublishRepositoryUrl>
    <!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
    <EmbedUntrackedSources>true</EmbedUntrackedSources>
    <!-- Optional: Include PDB in the built .nupkg -->
    <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="FsRegEx.fsi" />
    <Compile Include="FsRegEx.fs" />
    <Compile Include="VerbalExpressions.fsi" />
    <Compile Include="VerbalExpressions.fs" />
    <Compile Include="CommonFsRegEx.fsi" />
    <Compile Include="CommonFsRegEx.fs" />
    <None Include="paket.references" />
    <None Include="paket.template" />
    <None Include="Scripts\CompileToAssembly.fsx" />
    <None Include="Scripts\Escape.fsx" />
    <None Include="Scripts\GetGroupNames.fsx" />
    <None Include="Scripts\GetGroupNumbers.fsx" />
    <None Include="Scripts\Group.fsx" />
    <None Include="Scripts\GroupCollection.fsx" />
    <None Include="Scripts\GroupNameFromNumber.fsx" />
    <None Include="Scripts\IsMatch.fsx" />
    <None Include="Scripts\load-project-debug.fsx" />
    <None Include="Scripts\load-project-release.fsx" />
    <None Include="Scripts\load-references-debug.fsx" />
    <None Include="Scripts\load-references-release.fsx" />
    <None Include="Scripts\Match.fsx" />
    <None Include="Scripts\Matches.fsx" />
    <None Include="Scripts\MatchTimeout.fsx" />
    <None Include="Scripts\Replace.fsx" />
    <None Include="Scripts\Script1.fsx" />
    <None Include="Scripts\Split.fsx" />
  </ItemGroup>
  <Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>


text:
module FsRegEx

open System
open System.Text.RegularExpressions
open System.Threading

module Unicode =
    ///Enum Unicode defined general categories
    type UnicodeGeneralCategory =
        ///Letter, Uppercase; Lu
        | LetterUppercase
        ///Letter, Lowercase; Ll
        | LetterLowercase
        ///Letter, Titlecase; Lt
        | LetterTitlecase
        ///Letter, Modifier; Lm
        | LetterModifier
        ///Letter, Other; Lo
        | LetterOther
        ///All letter characters. This includes the LetterUppercase, LetterLowercase, LetterTitlecase, LetterModifier, and LetterOther characters; L
        | Letter
        ///Mark, Nonspacing; Mn
        | MarkNonspacing
        ///Mark, Spacing Combining; Mc
        | MarkSpacingCombining
        ///Mark, Enclosing; Me
        | MarkEnclosing
        ///All diacritic marks. This includes the MarkNonspacing, MarkSpacingCombining, and MarkEnclosing categories; M
        | Mark
        ///Number, Decimal Digit; Nd
        | NumberDecimalDigit
        ///Number, Letter; Nl
        | NumberLetter
        ///Number, Other; No
        | NumberOther
        ///All numbers. This includes the Nd, Nl, and No categories; N
        | NumberALL
        ///Punctuation, Connector; Pc
        | PunctuationConnector
        ///Punctuation, Dash; Pd
        | PunctuationDash
        ///Punctuation, Open; Ps
        | PunctuationOpen
        ///Punctuation, Close; Pe
        | PunctuationClose
        ///Punctuation, Initial quote (may behave like Ps or Pe depending on usage); Pi
        | PunctuationInitial
        ///Punctuation, Final quote (may behave like Ps or Pe depending on usage); Pf
        | PunctuationFinal
        ///Punctuation, Other; Po
        | PunctuationOther
        ///All punctuation characters. This includes the PunctuationConnector, PunctuationDash, PunctuationOpen, PunctuationClose, PunctuationInitial, PunctuationFinal, and PunctuationOther categories; P
        | Punctuation
        ///Symbol, Math; Sm
        | SymbolMath
        ///Symbol, Currency; Sc
        | SymbolCurrency
        ///Symbol, Modifier; Sk
        | SymbolModifier
        ///Symbol, Other; So
        | SymbolOther
        ///All symbols. This includes the SymbolMath, SymbolCurrency, SymbolModifier, and SymbolOther categories; S
        | Symbol
        ///Separator, Space; Zs
        | SeparatorSpace
        ///Separator, Line; Zl
        | SeparatorLine
        ///Separator, Paragraph; Zp
        | SeparatorParagraph
        ///All separator characters. This includes the SeparatorSpace, SeparatorLine, and SeparatorLine categories; Z
        | Separator
        ///Other, Control; Cc
        | OtherControl
        ///Other, Format; Cf
        | OtherFormat
        ///Other, Surrogate; Cs
        | OtherSurrogate
        ///Other, Private Use; Co
        | OtherPrivateUse
        ///Other, Not Assigned (no characters have this property); Cn
        | OtherNotAssigned
        ///All control characters. This includes the OtherControl, OtherFormat, OtherSurrogate, OtherPrivateUse, and OtherNotAssigned categories; C
        | ControlAll
        override __.ToString() =
            match __ with
            | LetterUppercase -> "Lu"
            | LetterLowercase -> "Ll"
            | LetterTitlecase -> "Lt"
            | LetterModifier -> "Lm"
            | LetterOther -> "Lo"
            | Letter -> "L"
            | MarkNonspacing -> "Mn"
            | MarkSpacingCombining -> "Mc"
            | MarkEnclosing -> "Me"
            | Mark -> "M"
            | NumberDecimalDigit -> "Nd"
            | NumberLetter -> "Nl"
            | NumberOther -> "No"
            | NumberALL -> "N"
            | PunctuationConnector -> "Pc"
            | PunctuationDash -> "Pd"
            | PunctuationOpen -> "Ps"
            | PunctuationClose -> "Pe"
            | PunctuationInitial -> "Pi"
            | PunctuationFinal -> "Pf"
            | PunctuationOther -> "Po"
            | Punctuation -> "P"
            | SymbolMath -> "Sm"
            | SymbolCurrency -> "Sc"
            | SymbolModifier -> "Sk"
            | SymbolOther -> "So"
            | Symbol -> "S"
            | SeparatorSpace -> "Zs"
            | SeparatorLine -> "Zl"
            | SeparatorParagraph -> "Zp"
            | Separator -> "Z"
            | OtherControl -> "Cc"
            | OtherFormat -> "Cf"
            | OtherSurrogate -> "Cs"
            | OtherPrivateUse -> "Co"
            | OtherNotAssigned -> "Cn"
            | ControlAll -> "C"

    ///Enum .NET Framework named Unicode blocks
    type SupportedNamedBlock =
        ///0000 - 007F
        | IsBasicLatin
        ///0080 - 00FF
        | IsLatin1Supplement
        ///0100 - 017F
        | IsLatinExtendedA
        ///0180 - 024F
        | IsLatinExtendedB
        ///0250 - 02AF
        | IsIPAExtensions
        ///02B0 - 02FF
        | IsSpacingModifierLetters
        ///0300 - 036F
        | IsCombiningDiacriticalMarks
        ///0370 - 03FF
        | IsGreek
        ///0370 - 03FF
        | IsGreekandCoptic
        ///0400 - 04FF
        | IsCyrillic
        ///0500 - 052F
        | IsCyrillicSupplement
        ///0530 - 058F
        | IsArmenian
        ///0590 - 05FF
        | IsHebrew
        ///0600 - 06FF
        | IsArabic
        ///0700 - 074F
        | IsSyriac
        ///0780 - 07BF
        | IsThaana
        ///0900 - 097F
        | IsDevanagari
        ///0980 - 09FF
        | IsBengali
        ///0A00 - 0A7F
        | IsGurmukhi
        ///0A80 - 0AFF
        | IsGujarati
        ///0B00 - 0B7F
        | IsOriya
        ///0B80 - 0BFF
        | IsTamil
        ///0C00 - 0C7F
        | IsTelugu
        ///0C80 - 0CFF
        | IsKannada
        ///0D00 - 0D7F
        | IsMalayalam
        ///0D80 - 0DFF
        | IsSinhala
        ///0E00 - 0E7F
        | IsThai
        ///0E80 - 0EFF
        | IsLao
        ///0F00 - 0FFF
        | IsTibetan
        ///1000 - 109F
        | IsMyanmar
        ///10A0 - 10FF
        | IsGeorgian
        ///1100 - 11FF
        | IsHangulJamo
        ///1200 - 137F
        | IsEthiopic
        ///13A0 - 13FF
        | IsCherokee
        ///1400 - 167F
        | IsUnifiedCanadianAboriginalSyllabics
        ///1680 - 169F
        | IsOgham
        ///16A0 - 16FF
        | IsRunic
        ///1700 - 171F
        | IsTagalog
        ///1720 - 173F
        | IsHanunoo
        ///1740 - 175F
        | IsBuhid
        ///1760 - 177F
        | IsTagbanwa
        ///1780 - 17FF
        | IsKhmer
        ///1800 - 18AF
        | IsMongolian
        ///1900 - 194F
        | IsLimbu
        ///1950 - 197F
        | IsTaiLe
        ///19E0 - 19FF
        | IsKhmerSymbols
        ///1D00 - 1D7F
        | IsPhoneticExtensions
        ///1E00 - 1EFF
        | IsLatinExtendedAdditional
        ///1F00 - 1FFF
        | IsGreekExtended
        ///2000 - 206F
        | IsGeneralPunctuation
        ///2070 - 209F
        | IsSuperscriptsandSubscripts
        ///20A0 - 20CF
        | IsCurrencySymbols
        ///20D0 - 20FF
        | IsCombiningDiacriticalMarksforSymbols
        ///20D0 - 20FF
        | IsCombiningMarksforSymbols
        ///2100 - 214F
        | IsLetterlikeSymbols
        ///2150 - 218F
        | IsNumberForms
        ///2190 - 21FF
        | IsArrows
        ///2200 - 22FF
        | IsMathematicalOperators
        ///2300 - 23FF
        | IsMiscellaneousTechnical
        ///2400 - 243F
        | IsControlPictures
        ///2440 - 245F
        | IsOpticalCharacterRecognition
        ///2460 - 24FF
        | IsEnclosedAlphanumerics
        ///2500 - 257F
        | IsBoxDrawing
        ///2580 - 259F
        | IsBlockElements
        ///25A0 - 25FF
        | IsGeometricShapes
        ///2600 - 26FF
        | IsMiscellaneousSymbols
        ///2700 - 27BF
        | IsDingbats
        ///27C0 - 27EF
        | IsMiscellaneousMathematicalSymbolsA
        ///27F0 - 27FF
        | IsSupplementalArrowsA
        ///2800 - 28FF
        | IsBraillePatterns
        ///2900 - 297F
        | IsSupplementalArrowsB
        ///2980 - 29FF
        | IsMiscellaneousMathematicalSymbolsB
        ///2A00 - 2AFF
        | IsSupplementalMathematicalOperators
        ///2B00 - 2BFF
        | IsMiscellaneousSymbolsandArrows
        ///2E80 - 2EFF
        | IsCJKRadicalsSupplement
        ///2F00 - 2FDF
        | IsKangxiRadicals
        ///2FF0 - 2FFF
        | IsIdeographicDescriptionCharacters
        ///3000 - 303F
        | IsCJKSymbolsandPunctuation
        ///3040 - 309F
        | IsHiragana
        ///30A0 - 30FF
        | IsKatakana
        ///3100 - 312F
        | IsBopomofo
        ///3130 - 318F
        | IsHangulCompatibilityJamo
        ///3190 - 319F
        | IsKanbun
        ///31A0 - 31BF
        | IsBopomofoExtended
        ///31F0 - 31FF
        | IsKatakanaPhoneticExtensions
        ///3200 - 32FF
        | IsEnclosedCJKLettersandMonths
        ///3300 - 33FF
        | IsCJKCompatibility
        ///3400 - 4DBF
        | IsCJKUnifiedIdeographsExtensionA
        ///4DC0 - 4DFF
        | IsYijingHexagramSymbols
        ///4E00 - 9FFF
        | IsCJKUnifiedIdeographs
        ///A000 - A48F
        | IsYiSyllables
        ///A490 - A4CF
        | IsYiRadicals
        ///AC00 - D7AF
        | IsHangulSyllables
        ///D800 - DB7F
        | IsHighSurrogates
        ///DB80 - DBFF
        | IsHighPrivateUseSurrogates
        ///DC00 - DFFF
        | IsLowSurrogates
        ///E000 - F8FF
        | IsPrivateUse
        ///F900 - FAFF
        | IsCJKCompatibilityIdeographs
        ///FB00 - FB4F
        | IsAlphabeticPresentationForms
        ///FB50 - FDFF
        | IsArabicPresentationFormsA
        ///FE00 - FE0F
        | IsVariationSelectors
        ///FE20 - FE2F
        | IsCombiningHalfMarks
        ///FE30 - FE4F
        | IsCJKCompatibilityForms
        ///FE50 - FE6F
        | IsSmallFormVariants
        ///FE70 - FEFF
        | IsArabicPresentationFormsB
        ///FF00 - FFEF
        | IsHalfwidthandFullwidthForms
        ///FFF0 - FFFF
        | IsSpecials
        override __.ToString() =
            match __ with
            | IsBasicLatin -> "IsBasicLatin"
            | IsLatin1Supplement -> "IsLatin-1Supplement"
            | IsLatinExtendedA -> "IsLatinExtended-A"
            | IsLatinExtendedB -> "IsLatinExtended-B"
            | IsIPAExtensions -> "IsIPAExtensions"
            | IsSpacingModifierLetters -> "IsSpacingModifierLetters"
            | IsCombiningDiacriticalMarks -> "IsCombiningDiacriticalMarks"
            | IsGreek -> "IsGreek"
            | IsGreekandCoptic -> "IsGreekandCoptic"
            | IsCyrillic -> "IsCyrillic"
            | IsCyrillicSupplement -> "IsCyrillicSupplement"
            | IsArmenian -> "IsArmenian"
            | IsHebrew -> "IsHebrew"
            | IsArabic -> "IsArabic"
            | IsSyriac -> "IsSyriac"
            | IsThaana -> "IsThaana"
            | IsDevanagari -> "IsDevanagari"
            | IsBengali -> "IsBengali"
            | IsGurmukhi -> "IsGurmukhi"
            | IsGujarati -> "IsGujarati"
            | IsOriya -> "IsOriya"
            | IsTamil -> "IsTamil"
            | IsTelugu -> "IsTelugu"
            | IsKannada -> "IsKannada"
            | IsMalayalam -> "IsMalayalam"
            | IsSinhala -> "IsSinhala"
            | IsThai -> "IsThai"
            | IsLao -> "IsLao"
            | IsTibetan -> "IsTibetan"
            | IsMyanmar -> "IsMyanmar"
            | IsGeorgian -> "IsGeorgian"
            | IsHangulJamo -> "IsHangulJamo"
            | IsEthiopic -> "IsEthiopic"
            | IsCherokee -> "IsCherokee"
            | IsUnifiedCanadianAboriginalSyllabics -> "IsUnifiedCanadianAboriginalSyllabics"
            | IsOgham -> "IsOgham"
            | IsRunic -> "IsRunic"
            | IsTagalog -> "IsTagalog"
            | IsHanunoo -> "IsHanunoo"
            | IsBuhid -> "IsBuhid"
            | IsTagbanwa -> "IsTagbanwa"
            | IsKhmer -> "IsKhmer"
            | IsMongolian -> "IsMongolian"
            | IsLimbu -> "IsLimbu"
            | IsTaiLe -> "IsTaiLe"
            | IsKhmerSymbols -> "IsKhmerSymbols"
            | IsPhoneticExtensions -> "IsPhoneticExtensions"
            | IsLatinExtendedAdditional -> "IsLatinExtendedAdditional"
            | IsGreekExtended -> "IsGreekExtended"
            | IsGeneralPunctuation -> "IsGeneralPunctuation"
            | IsSuperscriptsandSubscripts -> "IsSuperscriptsandSubscripts"
            | IsCurrencySymbols -> "IsCurrencySymbols"
            | IsCombiningDiacriticalMarksforSymbols -> "IsCombiningDiacriticalMarksforSymbols"
            | IsCombiningMarksforSymbols -> "IsCombiningMarksforSymbols"
            | IsLetterlikeSymbols -> "IsLetterlikeSymbols"
            | IsNumberForms -> "IsNumberForms"
            | IsArrows -> "IsArrows"
            | IsMathematicalOperators -> "IsMathematicalOperators"
            | IsMiscellaneousTechnical -> "IsMiscellaneousTechnical"
            | IsControlPictures -> "IsControlPictures"
            | IsOpticalCharacterRecognition -> "IsOpticalCharacterRecognition"
            | IsEnclosedAlphanumerics -> "IsEnclosedAlphanumerics"
            | IsBoxDrawing -> "IsBoxDrawing"
            | IsBlockElements -> "IsBlockElements"
            | IsGeometricShapes -> "IsGeometricShapes"
            | IsMiscellaneousSymbols -> "IsMiscellaneousSymbols"
            | IsDingbats -> "IsDingbats"
            | IsMiscellaneousMathematicalSymbolsA -> "IsMiscellaneousMathematicalSymbols-A"
            | IsSupplementalArrowsA -> "IsSupplementalArrows-A"
            | IsBraillePatterns -> "IsBraillePatterns"
            | IsSupplementalArrowsB -> "IsSupplementalArrows-B"
            | IsMiscellaneousMathematicalSymbolsB -> "IsMiscellaneousMathematicalSymbols-B"
            | IsSupplementalMathematicalOperators -> "IsSupplementalMathematicalOperators"
            | IsMiscellaneousSymbolsandArrows -> "IsMiscellaneousSymbolsandArrows"
            | IsCJKRadicalsSupplement -> "IsCJKRadicalsSupplement"
            | IsKangxiRadicals -> "IsKangxiRadicals"
            | IsIdeographicDescriptionCharacters -> "IsIdeographicDescriptionCharacters"
            | IsCJKSymbolsandPunctuation -> "IsCJKSymbolsandPunctuation"
            | IsHiragana -> "IsHiragana"
            | IsKatakana -> "IsKatakana"
            | IsBopomofo -> "IsBopomofo"
            | IsHangulCompatibilityJamo -> "IsHangulCompatibilityJamo"
            | IsKanbun -> "IsKanbun"
            | IsBopomofoExtended -> "IsBopomofoExtended"
            | IsKatakanaPhoneticExtensions -> "IsKatakanaPhoneticExtensions"
            | IsEnclosedCJKLettersandMonths -> "IsEnclosedCJKLettersandMonths"
            | IsCJKCompatibility -> "IsCJKCompatibility"
            | IsCJKUnifiedIdeographsExtensionA -> "IsCJKUnifiedIdeographsExtensionA"
            | IsYijingHexagramSymbols -> "IsYijingHexagramSymbols"
            | IsCJKUnifiedIdeographs -> "IsCJKUnifiedIdeographs"
            | IsYiSyllables -> "IsYiSyllables"
            | IsYiRadicals -> "IsYiRadicals"
            | IsHangulSyllables -> "IsHangulSyllables"
            | IsHighSurrogates -> "IsHighSurrogates"
            | IsHighPrivateUseSurrogates -> "IsHighPrivateUseSurrogates"
            | IsLowSurrogates -> "IsLowSurrogates"
            | IsPrivateUse -> "IsPrivateUse"
            | IsCJKCompatibilityIdeographs  -> "IsCJKCompatibilityIdeographs "
            | IsAlphabeticPresentationForms  -> "IsAlphabeticPresentationForms "
            | IsArabicPresentationFormsA  -> "IsArabicPresentationForms-A "
            | IsVariationSelectors  -> "IsVariationSelectors "
            | IsCombiningHalfMarks  -> "IsCombiningHalfMarks "
            | IsCJKCompatibilityForms  -> "IsCJKCompatibilityForms "
            | IsSmallFormVariants  -> "IsSmallFormVariants "
            | IsArabicPresentationFormsB  -> "IsArabicPresentationForms-B "
            | IsHalfwidthandFullwidthForms  -> "IsHalfwidthandFullwidthForms "
            | IsSpecials -> "IsSpecials"

type FsGroup (name : string, group : Group) =
    let mutable captures : Capture [] option = None
    override __.Equals(yobj) =

        match yobj with
        | :? FsGroup as y -> (group = y.Group)
        | _ -> false
    override __.GetHashCode() = group.GetHashCode()
    override __.ToString() = group.ToString()
    member __.Captures() =
        match captures with
        | Some x -> x
        | None ->
            let a : Capture[] = Array.zeroCreate group.Captures.Count
            group.Captures.CopyTo(a, 0)
            captures <- Some a
            a
    member __.Group = group
    member __.Index =
        group.Index
    member __.Length =
        group.Length
    member ___.Name = name
    member __.Success =
        group.Success
    member __.Value =
        group.Value

type FsMatch (regex : Regex, fsMatch : Match) =
    override __.Equals(yobj) =

        match yobj with
        | :? FsMatch as y -> (fsMatch = y.Match)
        | _ -> false
    override __.GetHashCode() = fsMatch.GetHashCode()
    override __.ToString() = fsMatch.ToString()
    member __.Captures() =

        let a : Capture[] = Array.zeroCreate fsMatch.Captures.Count
        fsMatch.Captures.CopyTo(a, 0)
        a
    member __.Groups() =
        let a : Group[] = Array.zeroCreate fsMatch.Groups.Count
        fsMatch.Groups.CopyTo(a, 0)
        a
        |> Array.mapi (fun i t -> FsGroup(regex.GroupNameFromNumber(i), t))
    member __.Index =
        fsMatch.Index
    member __.Length =
        fsMatch.Length
    member __.Match = fsMatch
    member __.Result replacement =
        fsMatch.Result replacement
    member __.Success =
        fsMatch.Success
    member __.Value =
        fsMatch.Value

module internal Common =

    let arrayFromMatches regex (c : MatchCollection) =
        let a : Match[] = Array.zeroCreate c.Count
        c.CopyTo(a, 0)
        a
        |> Array.map (fun t -> new FsMatch(regex, t))

type FsRegEx(regularExpression : string, regexOptions : RegexOptions, matchTimeout : TimeSpan) =
    let mutable _matchTimeout = matchTimeout
    let mutable _regexOptions : RegexOptions = regexOptions
    let mutable _prefixes = ""
    let mutable _source = regularExpression
    let mutable _suffixes = ""
    let mutable _regex : Regex option = None

    override __.Equals(yobj) =
        match yobj with
        | :? FsRegEx as y -> (__.GetHashCode() = y.GetHashCode())
        | _ -> false

    override __.GetHashCode() =
        _regexOptions.GetHashCode().ToString() + __.ToString()
        |> hash

    override __.ToString() = _prefixes + _source + _suffixes

    new () =
        FsRegEx("", RegexOptions.None, Timeout.InfiniteTimeSpan)

    new (regexOptions : RegexOptions) =
        FsRegEx("", regexOptions, Timeout.InfiniteTimeSpan)

    new (regularExpression : string) =
        FsRegEx(regularExpression, RegexOptions.None, Timeout.InfiniteTimeSpan)

    new (regularExpression : string, regexOptions : RegexOptions) =
        FsRegEx(regularExpression, regexOptions, Timeout.InfiniteTimeSpan)

    member __.Regex =
        match _regex with
        | Some x -> x
        | None ->
            let regex = new Regex(__.ToString(), _regexOptions, _matchTimeout)

            _regex <- Some regex
            regex

    member __.Capture input (groupName : string) =
        let match' = __.Regex.Match input
        match'.Groups.[groupName].Value

    member __.Clone (newRegexOptions : RegexOptions option) =
        let v =
            match newRegexOptions with
            | Some x -> new FsRegEx(x)
            | None -> new FsRegEx(_regexOptions)

        v.Prefixes <- _prefixes
        v.Source <- _source
        v.Suffixes <- _suffixes
        v

    member __.GroupNameFromNumber n =
        let name =
            __.Regex.GroupNameFromNumber n

        if String.IsNullOrEmpty name then None
        else Some name

    member __.GroupNames() =
        __.Regex.GetGroupNames()

    member __.GroupNumberFromName groupName =
        let n =
            __.Regex.GroupNumberFromName groupName
        if n = -1 then None
        else Some n

    member __.GroupNumbers() =
        __.Regex.GetGroupNumbers()

    member __.IsMatch input =
        __.Regex.IsMatch input

    member __.IsMatch (input, startAt) =
        __.Regex.IsMatch(input, startAt)

    member __.Match input =
        FsMatch (__.Regex, __.Regex.Match input)

    member __.Match (input, startAt) =
        FsMatch (__.Regex, __.Regex.Match(input, startAt))

    member __.Match (input, startAt, length) =
        FsMatch (__.Regex, __.Regex.Match(input, startAt, length))

    member __.Matches input =
        (__.Regex, __.Regex.Matches input)
        ||> Common.arrayFromMatches

    member __.Matches (input, startAt) =
        (__.Regex, __.Regex.Matches(input, startAt))
        ||> Common.arrayFromMatches

    member __.MatchTimeout =
        __.Regex.MatchTimeout

    member __.Prefixes
        with get() = _prefixes
        and set(value) = _prefixes <- value

    member __.RegexOptions = _regexOptions

    member __.Replace (input, (replacement : string)) =
        __.Regex.Replace(input, replacement)

    member __.Replace (input, (evalutor : MatchEvaluator)) =
        __.Regex.Replace(input, evalutor)

    member __.Replace (input, (replacement : string), count) =
        __.Regex.Replace(input, replacement, count)

    member __.Replace (input, (evalutor : MatchEvaluator), count) =
        __.Regex.Replace(input, evalutor, count)

    member __.Replace (input, (replacement : string), count, startAt) =
        __.Regex.Replace(input, replacement, count, startAt)

    member __.Replace (input, (evalutor : MatchEvaluator), count, startAt) =
        __.Regex.Replace(input, evalutor, count, startAt)

    member __.RightToLeft =
        __.Regex.RightToLeft

    member __.Source
        with get() = _source
        and set(value) = _source <- value

    member __.Suffixes
        with get() = _suffixes
        and set(value) = _suffixes <- value

    member  __.Split input =
        __.Regex.Split input

    member  __.Split (input, count) =
        __.Regex.Split(input, count)

    member  __.Split (input, count, startAt) =
        __.Regex.Split(input, count, startAt)

let firstMatch regularExpression input =
    let regex = new Regex(regularExpression)
    FsMatch (regex, Regex.Match(input, regularExpression))

let firstMatchOpt regularExpression regexOptions input =
    let regex = new Regex(regularExpression)
    FsMatch (regex, Regex.Match(input, regularExpression, regexOptions))

let matchAt regularExpression startAt input =
    let regex = new Regex(regularExpression)
    FsMatch (regex, regex.Match (input, startAt))

let matchAtOpt regularExpression regexOptions startAt input =
    let regex = new Regex(regularExpression, regexOptions)
    FsMatch (regex, regex.Match (input, startAt))

let matchAtFor regularExpression startAt length input =
    let regex = new Regex(regularExpression)
    FsMatch (regex, regex.Match (input, startAt, length))

let matchAtForOpt regularExpression regexOptions startAt length input =
    let regex = new Regex(regularExpression, regexOptions)
    FsMatch (regex, regex.Match (input, startAt, length))

let matches regularExpression input =
    let regex = new Regex(regularExpression)
    (regex, regex.Matches(input))
    ||> Common.arrayFromMatches

let matchesOpt regularExpression regexOptions input =
    let regex = new Regex(regularExpression, regexOptions)
    (regex, regex.Matches(input))
    ||> Common.arrayFromMatches

let matchesAt regularExpression startAt input =
    let regex = new Regex(regularExpression)
    (regex, regex.Matches(input, startAt))
    ||>Common.arrayFromMatches

let matchesAtOpt regularExpression regexOptions startAt input =
    let regex = new Regex(regularExpression, regexOptions)
    (regex, regex.Matches(input, startAt))
    ||> Common.arrayFromMatches

let replace regularExpression (replacement : string) input =
    Regex.Replace(input, regularExpression, replacement)

let replaceOpt regularExpression regexOptions (replacement : string) input =
    Regex.Replace(input, regularExpression, replacement, regexOptions)

let replaceByMatch regularExpression (evalutor : MatchEvaluator) input =
    Regex.Replace(input, regularExpression, evalutor)

let replaceByMatchOpt regularExpression regexOptions (evalutor : MatchEvaluator) input =
    Regex.Replace(input, regularExpression, evalutor, regexOptions)

let replaceMaxTimes regularExpression (replacement : string) count input =
    (new Regex(regularExpression)).Replace(input, replacement, count )

let replaceMaxTimesOpt regularExpression regexOptions (replacement : string) count input =
    (new Regex(regularExpression, regexOptions)).Replace(input, replacement, count )

let replaceByMatchMaxTimes regularExpression (evalutor : MatchEvaluator) count input =
    (new Regex(regularExpression)).Replace(input, evalutor, count)

let replaceByMatchMaxTimesOpt regularExpression regexOptions (evalutor : MatchEvaluator) count input =
    (new Regex(regularExpression, regexOptions)).Replace(input, evalutor, count)

let replaceMaxTimesStartAt regularExpression (replacement : string) count startAt input =
    (new Regex(regularExpression)).Replace(input, replacement, count, startAt)

let replaceMaxTimesStartAtOpt regularExpression regexOptions (replacement : string) count startAt input =
    (new Regex(regularExpression, regexOptions)).Replace(input, replacement, count, startAt)

let replaceByMatchMaxTimesStartAt regularExpression (evalutor : MatchEvaluator) count startAt input =
    (new Regex(regularExpression)).Replace(input, evalutor, count, startAt)

let replaceByMatchMaxTimesStartAtOpt regularExpression regexOptions (evalutor : MatchEvaluator) count startAt input =
    (new Regex(regularExpression, regexOptions)).Replace(input, evalutor, count, startAt)

let split regularExpression input =
    Regex.Split(input, regularExpression)

let splitOpt regularExpression regexOptions input =
    Regex.Split(input, regularExpression, regexOptions)

let splitMaxTimes regularExpression count input =
    (new Regex(regularExpression)).Split (input, count)

let splitMaxTimesOpt regularExpression regexOptions count input =
    (new Regex(regularExpression, regexOptions)).Split (input, count)

let splitMaxTimesStartAt regularExpression count startAt input =
    (new Regex(regularExpression)).Split (input, count, startAt)

let splitMaxTimesStartAtOpt regularExpression regexOptions count startAt input =
    (new Regex(regularExpression, regexOptions)).Split (input, count, startAt)

let capture regularExpression (groupName : string) input =
    let match' = (new Regex(regularExpression)).Match input
    match'.Groups.[groupName].Value

let captureOpt regularExpression regexOptions (groupName : string) input =
    let match' = (new Regex(regularExpression, regexOptions)).Match input
    match'.Groups.[groupName].Value

let captureGroup regularExpression (groupName : string) input =
    let regex = new Regex(regularExpression)

    let match' = regex.Match input
    (groupName, match'.Groups.[groupName])
    |> FsGroup

let captureGroupOpt regularExpression regexOptions (groupName : string) input =
    let regex = new Regex(regularExpression, regexOptions)

    let match' = regex.Match input
    (groupName, match'.Groups.[groupName])
    |> FsGroup

let groupNames regularExpression =
    (new Regex(regularExpression)).GetGroupNames()

let groupNumbers regularExpression =
    (new Regex(regularExpression)).GetGroupNumbers()

let isMatch regularExpression input =
    Regex.IsMatch(input, regularExpression)

let isMatchOpt regularExpression regexOptions input =
    Regex.IsMatch(input, regularExpression, regexOptions)

let isMatchAt regularExpression startAt input =
    (new Regex(regularExpression)).IsMatch (input, startAt)

let isMatchAtOpt regularExpression regexOptions startAt input =
    (new Regex(regularExpression, regexOptions)).IsMatch (input, startAt)


text:
module CommonFsRegEx

open FsRegEx

/// From http://emailregex.com/
let Email = new FsRegEx(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}")

let Url = new FsRegEx(@"((([A-Za-z]{3,9}:(?:\/\/)?)(?:[^-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(:[0-9]+)?|(?:www.|[^-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w_]*)?\??(?:[-\+=&;%@.\w-_]*)#?(?:[\w]*))?)")


text:
/// Functions supporting composable verbal expression natural language regular expressions.
module VerbalExpressions

open System
open System.Text.RegularExpressions
open FsRegEx

///Searches the specified input string for the first occurrence of the FsRegEx.
val firstMatch : input : string -> fsRegEx : FsRegEx -> FsMatch

///Searches the specified input string for the first occurrence of the FsRegEx beginning at the specified starting position.
val matchAt : input : string -> startAt : int -> fsRegEx : FsRegEx -> FsMatch

///Searches the specified input string for the first occurrence of the FsRegEx beginning at the starting position for the length.
val matchAtFor : input : string -> startAt : int ->  length : int -> fsRegEx : FsRegEx -> FsMatch

///Searches the specified input string for all occurrences of a regular expression.
val matches : input : string -> fsRegEx : FsRegEx -> FsMatch[]

///Searches the input string for all occurrence of a regular expression, beginning at the specified starting position.
val matchesAt : input : string -> startAt : int -> fsRegEx : FsRegEx -> FsMatch[]

///In input string replaces all strings that match regular expression pattern with replacement string.
val replace : input : string -> replacement : string -> fsRegEx : FsRegEx -> string

///In input string replaces all strings that match regular expression with string returned by MatchEvaluator delegate.
val replaceByMatch : input : string -> evalutor : MatchEvaluator -> fsRegEx : FsRegEx -> string

///In input string replaces a specified maximum number of strings that match regular expression with replacement string.
val replaceMaxTimes : input : string -> replacement : string -> count : int -> fsRegEx : FsRegEx -> string

///In input string replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate.
val replaceByMatchMaxTimes : input : string -> evalutor : MatchEvaluator -> count : int -> fsRegEx : FsRegEx -> string

///In input string beginning at start at position replaces a specified maximum number of strings that match regular expression with replacement string.
val replaceMaxTimesStartAt : input : string -> replacement : string -> count : int -> startAt : int -> fsRegEx : FsRegEx -> string

///In input string beginning at start at position replaces a specified maximum number of strings that match a regular expression with string returned by MatchEvaluator delegate.
val replaceByMatchMaxTimesStartAt : input : string -> evalutor : MatchEvaluator -> count : int -> startAt : int -> fsRegEx : FsRegEx -> string

///Splits input string into an array of substrings at the positions defined by regular expression.
val split : input : string -> fsRegEx : FsRegEx -> array<string>

///Splits input string a specified maximum number of times into an array of substrings at the positions defined by regular expression.
val splitMaxTimes : input : string -> count : int -> fsRegEx : FsRegEx -> array<string>

///Splits input string, begining at start position, a specified maximum number of times into an array of substrings at the positions defined by regular expression.
val splitMaxTimesStartAt : input : string -> count : int -> startAt : int -> fsRegEx : FsRegEx -> array<string>

///Return new FsRegEx with new RegExOptions.
val resetRegexOptions : newRegexOptions : RegexOptions option -> fsRegEx : FsRegEx -> FsRegEx

///Match and select groupname value.
val capture : input : string -> groupName : string -> fsRegEx : FsRegEx -> string

///Indicates whether the regular expression finds a match in the input string.
val isMatch : value : string -> fsRegEx : FsRegEx -> bool

///Indicates whether the regular expression finds a match in the input string beginning at the specified starting position.
val isMatchAt : value : string -> startAt : int -> fsRegEx : FsRegEx -> bool

///Returns an array of capturing group names for the regular expression.
val groupNames : fsRegEx : FsRegEx -> array<string>

///Returns an array of capturing group numbers that correspond to group names in an array.
val groupNumbers : fsRegEx : FsRegEx -> array<int>

///Value of regular expression.
val toString : fsRegEx : FsRegEx -> string

///Mark the expression to start at the beginning of the line; ^
val startOfLine : fsRegEx : FsRegEx -> FsRegEx

///Mark the expression to end at the last character of the line; $
val endOfLine : fsRegEx : FsRegEx -> FsRegEx

///Append unescaped literal expression to the expression.
val add : value : string -> fsRegEx : FsRegEx -> FsRegEx

///Append escaped literal expression to the expression. (Same as find.)
val then' : value : string -> fsRegEx : FsRegEx -> FsRegEx

///Append escaped literal expression to the expression. (Same as then'.)
val find : value : string -> fsRegEx : FsRegEx -> FsRegEx

///Add escaped string to the expression that might appear once (or not); (value)?
val maybe : value : string -> fsRegEx : FsRegEx -> FsRegEx

///Zero or more of any character; (.*)
val anything : fsRegEx : FsRegEx -> FsRegEx

///Zero or more of any character except escaped character(s); ([^value]*)
val anythingBut : value : string -> fsRegEx : FsRegEx -> FsRegEx

///One or more of any character; (.+)
val something : fsRegEx : FsRegEx -> FsRegEx

///One or more of any character except escaped character; ([^%s]+)
val somethingBut : value : string -> fsRegEx : FsRegEx -> FsRegEx

///Refers to nth occurence of capturing groups; \ordinal
val backReference : ordinal : int -> fsRegEx : FsRegEx -> FsRegEx

///Refers to named capturing group; \k<groupname>
val namedBackReference : groupname : string -> fsRegEx : FsRegEx -> FsRegEx

///Add expression to match a range (or multiple ranges), unescaped values.
val range : collection : seq<obj> -> fsRegEx : FsRegEx -> FsRegEx

///Matches universal line break expression; \n
val lineBreak : fsRegEx : FsRegEx -> FsRegEx

///Same as lineBreak; \n
val br : fsRegEx : FsRegEx ->  FsRegEx

///Matches a tab character; \t
val tab : fsRegEx : FsRegEx -> FsRegEx

///Matches any white-space character; \s
val whiteSpace : fsRegEx : FsRegEx -> FsRegEx

///Matches any non-white-space character; \S.
val nonWhiteSpace : fsRegEx : FsRegEx -> FsRegEx

///Expression to match a word; \w+
val word : fsRegEx : FsRegEx -> FsRegEx

///Matches any word character; \w
val wordCharacter  : fsRegEx : FsRegEx -> FsRegEx

///Matches any nonword character; \W
val nonWordCharacter  : fsRegEx : FsRegEx -> FsRegEx

///Matches any decimal digit; \d
val digit  : fsRegEx : FsRegEx -> FsRegEx

///Matches any nondigit; \D
val nonDigit  : fsRegEx : FsRegEx -> FsRegEx

///Matches any single character included in the specified set of escaped characters; [value]
val anyOf : value : string -> fsRegEx : FsRegEx -> FsRegEx

///Same as anyOf.
val any : value : string -> fsRegEx : FsRegEx ->  FsRegEx

///The escaped expression 1 or more times; (value)+
val multiple : value : string -> fsRegEx : FsRegEx -> FsRegEx

///The FsRegEx 1 or more times; (sourceFsRegEx)+
val multipleFsRegEx : sourceFsRegEx : FsRegEx -> fsRegEx : FsRegEx -> FsRegEx

///Or's the regular expression to the regular expression in a FsRegEx.
val or' : regularExpression : string -> fsRegEx : FsRegEx -> FsRegEx

///Return new FsRegEx of two FsRegExs or'ed.
val fsRegExOrFsRegEx : regexOptions : RegexOptions -> fsRegEx : FsRegEx -> fsRegEx : FsRegEx -> FsRegEx

///Begin capture group; (
val beginCapture : fsRegEx : FsRegEx -> FsRegEx

///Begin named capture group ;(?<groupName>
val beginCaptureNamed : groupName : string -> fsRegEx : FsRegEx -> FsRegEx

///End capture group; )
val endCapture : fsRegEx : FsRegEx -> FsRegEx

///Repeat previous exact number of times; {n}
val repeatPrevious : n : int -> FsRegEx -> FsRegEx

///Repeat previous number of times between n and m; {n,m}
val repeatBetweenPrevious : n : int ->  m : int -> FsRegEx -> FsRegEx

///Matches a Unicode character by using hexadecimal representation  (exactly four digits, as represented by nnnn); \unnnn
val unicode : nnnn : string -> FsRegEx -> FsRegEx

///Matches any single character in the Unicode general category; \p{name}
val unicodeCategory : category : Unicode.UnicodeGeneralCategory -> FsRegEx -> FsRegEx

///Matches any single character that is not in the Unicode general category; \P{name}
val notUnicodeCategory : category : Unicode.UnicodeGeneralCategory -> FsRegEx -> FsRegEx

///Matches any single character in the supported named block; \p{name}
val namedBlock : name : Unicode.SupportedNamedBlock -> FsRegEx -> FsRegEx

///Matches any single character that is not in the supported named block; \P{name}
val notNamedBlock : name : Unicode.SupportedNamedBlock -> FsRegEx -> FsRegEx

///Executes a function on a FsRegEx.
val iter : f : (FsRegEx -> unit) -> fsRegEx : FsRegEx -> unit

///Transforms a FsRegEx  with a mapping function
val map : f : (FsRegEx -> FsRegEx) -> fsRegEx : FsRegEx -> FsRegEx

///Applies a function to a FsRegEx and a state returning a state
val fold : f : ('State -> FsRegEx -> 'State) -> state : 'State -> fsRegEx : FsRegEx -> 'State

///Applies a function to a FsRegEx and a state returning a state
val foldBack : f : (FsRegEx -> 'State -> 'State) -> fsRegEx : FsRegEx -> state : 'State -> 'State

///Evaluates the boolean function on the FsRegEx
val exists : f : (FsRegEx -> bool) -> fsRegEx : FsRegEx -> bool


text:
// https://msdn.microsoft.com/en-us/library/e7sf90t3(v=vs.110).aspx

#I __SOURCE_DIRECTORY__
#load "load-project-debug.fsx"

open System
open System.Text.RegularExpressions

let pattern = @"\b\w+es\b"
let rgx = new Regex(pattern)
let sentence = "Who writes these notes?"

for m in rgx.Matches(sentence) do
    printfn "Found '%s' at position %i" m.Value m.Index

// The example displays the following output:
//       Found 'writes' at position 4
//       Found 'notes' at position 17

sentence
|> FsRegEx.matches pattern
|> Array.iter (fun m -> printfn "Found '%s' at position %i" m.Value m.Index)

// https://msdn.microsoft.com/en-us/library/z9ekkwhs(v=vs.110).aspx

let pattern = @"\b\w+es\b"
let rgx = new Regex(pattern)
let sentence = "Who writes these notes and uses our paper?"

// Get the first match.
let m = rgx.Match(sentence)
if m.Success then
    printfn "Found first 'es' in '%s' at position %i" m.Value m.Index
    // Get any additional matches.
    for m in (rgx.Matches(sentence, m.Index + m.Length)) do
        printfn "Also found '%s' at position %i" m.Value m.Index

// The example displays the following output:
//       Found first 'es' in 'writes' at position 4
//       Also found 'notes' at position 17
//       Also found 'uses' at position 27

let m = FsRegEx.firstMatch pattern sentence

if m.Success then
    printfn "Found first 'es' in '%s' at position %i" m.Value m.Index
    sentence
    |> FsRegEx.matchesAt pattern (m.Index + m.Length)
    |> Array.iter (fun m -> printfn "Also found '%s' at position %i" m.Value m.Index)

// https://msdn.microsoft.com/en-us/library/b9712a7w(v=vs.110).aspx

let pattern = @"\b\w+es\b"
let sentence = "Who writes these notes?"

for m in (Regex.Matches(sentence, pattern)) do
    printfn "Found '%s' at position %i" m.Value m.Index

// The example displays the following output:
//       Found 'writes' at position 4
//       Found 'notes' at position 17

// https://msdn.microsoft.com/en-us/library/b49yw9s8(v=vs.110).aspx

let pattern = @"\b\w+es\b"
let sentence = "NOTES: Any notes or comments are optional."

// Call Matches method without specifying any options.
for m in (Regex.Matches(sentence, pattern)) do
    printfn "Found '%s' at position %i" m.Value m.Index
printfn ""

// Call Matches method for case-insensitive matching.
for m in (Regex.Matches(sentence, pattern, RegexOptions.IgnoreCase)) do
    printfn "Found '%s' at position %i" m.Value m.Index

// The example displays the following output:
//       Found 'notes' at position 11
//
//       Found 'NOTES' at position 0
//       Found 'notes' at position 11

// https://msdn.microsoft.com/en-us/library/hh160201(v=vs.110).aspx

let pattern = @"\b\w+es\b"
let sentence = "NOTES: Any notes or comments are optional."

// Call Matches method without specifying any options.
try
    for m in (Regex.Matches(sentence, pattern,
                                        RegexOptions.None,
                                        TimeSpan.FromSeconds(1.0))) do
        printfn "Found '%s' at position %i" m.Value m.Index
with
    | :? RegexMatchTimeoutException as e ->
        ()
    // Do Nothing: Assume that timeout represents no match.
printfn ""

// Call Matches method for case-insensitive matching.
try
    for match' in (Regex.Matches(sentence, pattern, RegexOptions.IgnoreCase)) do
        printfn "Found '%s' at position %i" match'.Value match'.Index
with
    | :? RegexMatchTimeoutException as e ->
        ()
    // Do Nothing: Assume that timeout represents no match.

// The example displays the following output:
//       Found 'notes' at position 11
//
//       Found 'NOTES' at position 0
//       Found 'notes' at position 11


text:
// Warning: generated file; your changes could be lost when a new file is generated.
#I __SOURCE_DIRECTORY__
#load "load-references-release.fsx"
#load "../UniCode.fs"
      "../Common.fs"
      "../FsRegEx.fsi"
      "../FsRegEx.fs"
      "../VerbalExpression.fsi"
      "../VerbalExpression.fs"
      "../CommonFsRegEx.fsi"
      "../CommonFsRegEx.fs"


text:
// https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.getgroupnames(v=vs.110).aspx

#I __SOURCE_DIRECTORY__
#load "load-project-debug.fsx"

open System.Text.RegularExpressions

let ShowMatches (r : Regex)  (m : Match) =
    let names = r.GetGroupNames()

    printfn "Named Groups:"

    for name in names do
         let grp = m.Groups.[name]
         printfn "   %s: '%s'" name grp.Value
    ()

let pattern = @"\b(?<FirstWord>\w+)\s?((\w+)\s)*(?<LastWord>\w+)?(?<Punctuation>\p{Po})"
let input = "The cow jumped over the moon."
let rgx = new Regex(pattern)
let m = rgx.Match(input)
if m.Success then
    ShowMatches rgx m
else ()

//       Named Groups:
//          0: 'The cow jumped over the moon.'
//          1: 'the '
//          2: 'the'
//          FirstWord: 'The'
//          LastWord: 'moon'
//          Punctuation: '.'

let pattern' = @"\b(?<FirstWord>\w+)\s?((\w+)\s)*(?<LastWord>\w+)?(?<Punctuation>\p{Po})"
let input' = "The cow jumped over the moon."

let m' = FsRegEx.firstMatch pattern' input'

printfn "Named Groups:"

m'.Groups()
|> Array.iter (fun g -> printfn "   %s: '%s'" g.Name g.Value)