text:
[![Issue Stats](http://issuestats.com/github/jackfoxy/FsRegEx/badge/issue)](http://issuestats.com/github/jackfoxy/FsRegEx)
[![Issue Stats](http://issuestats.com/github/jackfoxy/FsRegEx/badge/pr)](http://issuestats.com/github/jackfoxy/FsRegEx)

# FsRegEx

The `FsRegEx` library contains composable functions representing all available `Regex` functionality (except timeouts) with the target input string uniformly the last parameter to better support pipe forward `|>` composition and partial application.

- Documentation: [FsRegEx](http://jackfoxy.github.io/FsRegEx/)
- Nuget: [FsRegEx](https://www.nuget.org/packages/FsRegEx "FsRegEx")

## Pull requests welcome so long as

- they include excellent unit test coverage
- they include correct intellisense documentation
- they adhere to the concepts of composability

FsRegEx adheres to [Semantic Versioning](http://semver.org/ "Semantic Versioning"). So long as the project is pre-1.0.0 minor versions may be breaking. Once the project reaches 1.0.0 minor enhancements will be backwards-compatible.

## Maintainer(s)

- [@jackfoxy](https://github.com/jackfoxy)


text:
@echo off
cls

dotnet restore build.proj
dotnet fake build %*

repo_name: jackfoxy/FsRegEx

repo_language: F#

mime_type: text/plain


text:
// --------------------------------------------------------------------------------------
// FAKE build script
// --------------------------------------------------------------------------------------

#r "paket: groupref FakeBuild //"

#load "./.fake/build.fsx/intellisense.fsx"

open System.IO
open Fake.Core
open Fake.Core.TargetOperators
open Fake.DotNet
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.DotNet.Testing

// --------------------------------------------------------------------------------------
// START TODO: Provide project-specific details below
// --------------------------------------------------------------------------------------

// Information about the project are used
//  - for version and project name in generated AssemblyInfo file
//  - by the generated NuGet package
//  - to run tests and to publish documentation on GitHub gh-pages
//  - for documentation, you also need to edit info in "docsrc/tools/generate.fsx"

// The name of the project
// (used by attributes in AssemblyInfo, name of a NuGet package and directory in 'src')
let project = "FsRegEx"

// Short summary of the project
// (used as description in AssemblyInfo and as a short summary for NuGet package)
let summary = "Composable F# regular expressions."

// Longer description of the project
// (used as a description for NuGet package; line breaks are automatically cleaned up)
let description = "FsRegEx provides composable F# functionality for all the capabilities of the .NET Regex class including supporting pipe forward |> composability."

// List of author names (for NuGet package)
let author = "Jack Fox"

// Tags for your project (for NuGet package)
let tags = "F# fsharp regularexpression"

// File system information
let solutionFile  = "FsRegEx.sln"

// Default target configuration
let configuration = "Release"

// Pattern specifying assemblies to be tested using Expecto
let testAssemblies = "tests/**/bin" </> configuration </> "net47" </> "FsRegEx.Tests.exe"

// Git configuration (used for publishing documentation in gh-pages branch)
// The profile where the project is posted
let gitOwner = "jackfoxy"
let gitHome = sprintf "%s/%s" "https://github.com" gitOwner

// The name of the project on GitHub
let gitName = "FsRegEx"

// The url for the raw files hosted
let gitRaw = Environment.environVarOrDefault "gitRaw" "https://raw.githubusercontent.com/jackfoxy"

let website = "/FsRegEx"

// --------------------------------------------------------------------------------------
// END TODO: The rest of the file includes standard build steps
// --------------------------------------------------------------------------------------

// Read additional information from the release notes document
let release = ReleaseNotes.load "RELEASE_NOTES.md"

// Helper active pattern for project types
let (|Fsproj|Csproj|Vbproj|Shproj|) (projFileName:string) =
    match projFileName with
    | f when f.EndsWith("fsproj") -> Fsproj
    | f when f.EndsWith("csproj") -> Csproj
    | f when f.EndsWith("vbproj") -> Vbproj
    | f when f.EndsWith("shproj") -> Shproj
    | _                           -> failwith (sprintf "Project file %s not supported. Unknown project type." projFileName)

// Generate assembly info files with the right version & up-to-date information
Target.create "AssemblyInfo" (fun _ ->
    let getAssemblyInfoAttributes projectName =
        [ AssemblyInfo.Title (projectName)
          AssemblyInfo.Product project
          AssemblyInfo.Description summary
          AssemblyInfo.Version release.AssemblyVersion
          AssemblyInfo.FileVersion release.AssemblyVersion
          AssemblyInfo.Configuration configuration ]

    let getProjectDetails projectPath =
        let projectName = Path.GetFileNameWithoutExtension(projectPath)
        ( projectPath,
          projectName,
          Path.GetDirectoryName(projectPath),
          (getAssemblyInfoAttributes projectName)
        )

    !! "src/**/*.??proj"
    |> Seq.map getProjectDetails
    |> Seq.iter (fun (projFileName, _, folderName, attributes) ->
        match projFileName with
        | Fsproj -> AssemblyInfoFile.createFSharp (folderName </> "AssemblyInfo.fs") attributes
        | Csproj -> AssemblyInfoFile.createCSharp ((folderName </> "Properties") </> "AssemblyInfo.cs") attributes
        | Vbproj -> AssemblyInfoFile.createVisualBasic ((folderName </> "My Project") </> "AssemblyInfo.vb") attributes
        | Shproj -> ()
        )
)

// Copies binaries from default VS location to expected bin folder
// But keeps a subdirectory structure for each project in the
// src folder to support multiple project outputs
Target.create "CopyBinaries" (fun _ ->
    !! "src/**/*.??proj"
    -- "src/**/*.shproj"
    |>  Seq.map (fun f -> ((Path.getDirectory f) </> "bin" </> configuration, "bin" </> (Path.GetFileNameWithoutExtension f)))
    |>  Seq.iter (fun (fromDir, toDir) -> Shell.copyDir toDir fromDir (fun _ -> true))
)

// --------------------------------------------------------------------------------------
// Clean build results

let buildConfiguration = DotNet.Custom <| Environment.environVarOrDefault "configuration" configuration

Target.create "Clean" (fun _ ->
    Shell.cleanDirs ["bin"; "temp"]
)

Target.create "CleanDocs" (fun _ ->
    Shell.cleanDirs ["docs"]
)

// --------------------------------------------------------------------------------------
// Build library & test project

Target.create "Build" (fun _ ->
    solutionFile
    |> DotNet.build (fun p ->
        { p with
            Configuration = buildConfiguration })
)

// --------------------------------------------------------------------------------------
// Run the unit tests using test runner

Target.create "RunTests" (fun _ ->
    !! testAssemblies
    |> Expecto.run id
)

// --------------------------------------------------------------------------------------
// Build a NuGet package

Target.create "NuGet" (fun _ ->
    Paket.pack(fun p ->
        { p with
            OutputPath = "bin"
            Version = release.NugetVersion
            ReleaseNotes = String.toLines release.Notes})
)

// --------------------------------------------------------------------------------------
// Generate the documentation

// Paths with template/source/output locations
let bin        = __SOURCE_DIRECTORY__ @@ "bin"
let content    = __SOURCE_DIRECTORY__ @@ "docsrc\\content"
let output     = __SOURCE_DIRECTORY__ @@ "docs"
let files      = __SOURCE_DIRECTORY__ @@ "docsrc\\files"
let templates  = __SOURCE_DIRECTORY__ @@ "docsrc\\tools\\templates"
let formatting = __SOURCE_DIRECTORY__ @@ "packages\\formatting\\FSharp.Formatting"
let docTemplate = "docpage.cshtml"

let github_release_user = Environment.environVarOrDefault "github_release_user" gitOwner
let githubLink = sprintf "https://github.com/%s/%s" github_release_user gitName

let info =
  [ "project-name", project
    "project-author", author
    "project-summary", summary
    "project-github", githubLink
    "project-nuget", "http://nuget.org/packages/FsRegEx" ]

let root = website

let referenceBinaries = []

let layoutRootsAll = new System.Collections.Generic.Dictionary<string, string list>()
layoutRootsAll.Add("en",[   templates;
                            formatting @@ "templates"
                            formatting @@ "templates/reference" ])

Target.create "ReferenceDocs" (fun _ ->
    Directory.ensure (output @@ "reference")

    let binaries () =
        let manuallyAdded =
            referenceBinaries
            |> List.map (fun b -> bin @@ b)

        let conventionBased =
            DirectoryInfo.getSubDirectories <| DirectoryInfo bin
            |> Array.map (fun d ->
                let net45Bin =
                    DirectoryInfo.getSubDirectories d |> Array.filter(fun x -> x.FullName.ToLower().Contains("net45"))
                let net47Bin =
                    DirectoryInfo.getSubDirectories d |> Array.filter(fun x -> x.FullName.ToLower().Contains("net47"))
                if net45Bin.Length > 0 then
                    d.Name, net45Bin.[0]
                else
                    d.Name, net47Bin.[0]  )
            |> Array.map (fun (name, d) ->
                d.GetFiles()
                |> Array.filter (fun x ->
                    x.Name.ToLower() = (sprintf "%s.dll" name).ToLower())
                |> Array.map (fun x -> x.FullName)
                )
            |> Array.concat
            |> List.ofArray

        conventionBased @ manuallyAdded

    binaries()
    |> FSFormatting.createDocsForDlls (fun args ->
        { args with
            OutputDirectory = output @@ "reference"
            LayoutRoots =  layoutRootsAll.["en"]
            ProjectParameters =  ("root", root)::info
            SourceRepository = githubLink @@ "tree/master" }
           )
)

let copyFiles () =
    Shell.copyRecursive files output true
    |> Trace.logItems "Copying file: "
    Directory.ensure (output @@ "content")
    Shell.copyRecursive (formatting @@ "styles") (output @@ "content") true
    |> Trace.logItems "Copying styles and scripts: "

Target.create "Docs" (fun _ ->
    File.delete "docsrc/content/release-notes.md"
    Shell.copyFile "docsrc/content/" "RELEASE_NOTES.md"
    Shell.rename "docsrc/content/release-notes.md" "docsrc/content/RELEASE_NOTES.md"

    File.delete "docsrc/content/license.md"
    Shell.copyFile "docsrc/content/" "LICENSE.txt"
    Shell.rename "docsrc/content/license.md" "docsrc/content/LICENSE.txt"

    DirectoryInfo.getSubDirectories (DirectoryInfo.ofPath templates)
    |> Seq.iter (fun d ->
                    let name = d.Name
                    if name.Length = 2 || name.Length = 3 then
                        layoutRootsAll.Add(
                                name, [templates @@ name
                                       formatting @@ "templates"
                                       formatting @@ "templates/reference" ]))
    copyFiles ()

    for dir in  [ content; ] do
        let langSpecificPath(lang, path:string) =
            path.Split([|'/'; '\\'|], System.StringSplitOptions.RemoveEmptyEntries)
            |> Array.exists(fun i -> i = lang)
        let layoutRoots =
            let key = layoutRootsAll.Keys |> Seq.tryFind (fun i -> langSpecificPath(i, dir))
            match key with
            | Some lang -> layoutRootsAll.[lang]
            | None -> layoutRootsAll.["en"] // "en" is the default language

        FSFormatting.createDocs (fun args ->
            { args with
                Source = content
                OutputDirectory = output
                LayoutRoots = layoutRoots
                ProjectParameters  = ("root", root)::info
                Template = docTemplate } )
)

Target.create "GenerateDocs" ignore

// --------------------------------------------------------------------------------------
// Run all targets by default. Invoke 'build <Target>' to override

Target.create "All" ignore

"Clean"
  ==>"AssemblyInfo"
  ==> "Build"
  ==> "CopyBinaries"
  ==> "RunTests"
  ==> "GenerateDocs"
  ==> "NuGet"
  ==> "All"

"RunTests" ?=> "CleanDocs"

"CleanDocs"
  ==> "Docs"
  ==> "ReferenceDocs"
  ==> "GenerateDocs"

Target.runOrDefault "All"


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>release-notes</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

0.7.2 - June 9, 2018

multi-target net45, netstandard2.0

support SourceLink

FSharp.Core 4.5

0.7.1 - December 29, 2017

multi-target release: net45, net47, netstandard2.0, netcoreapp2.0

0.7.0 - May 16, 2017

initial release as FsRegEx

breaking change, derived from FSharpVerbalExpressons, which is now deprecated

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
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

The FsRegEx library provides composable F# functionality for nearly all the capabilites of the .NET Regex class, supporting uniform pipe forward |> composability and all Regex features except timeouts. Optionally you can compose F# verbal expressions in natural language. Lazy evaluation ensures natural language composition imposes no performance penalty.

      The FsRegEx library can be installed from NuGet:

PM> Install-Package FsRegEx

Introduction

The FsRegEx library brings a composable regular expression experience to F#.

Composable functions representing all available Regex functionality (except timeouts) with the target input string uniformly the last parameter to better support pipe forward |> composition and partial application.

Collections returned as F# arrays rather than Regex special collections for better composability (but sacrificing lazy match evaluation and timeout support).

Short-cut functions like capture on group name make common multi-step processes a single function.

FsRegEx - A composable F# wrapper type over System.Text.RegularExpressions.Regex for natural language regular expression composition.

FsMatch - A composable F# wrapper type over System.Text.RegularExpressions.Match.

FsGroup - A composable F# wrapper type over System.Text.RegularExpressions.Group.

Basic functional operations on FsRegEx (exists, fold, foldBack, iter, and map), among other composable functions.

FsRegEx speciall collections are returned as arrays. This does lose the advantange of lazy match evaluation the special collections provide.
The underlying object can always be returned from the wrapper.

Better F# Composition

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:

open FsRegEx

let carRegExp = @"(\w+)\s+(car)"

sprintf "%s %s %s" "One car" "red car" "blue car"
|> matches carRegExp
|> Array.iter(fun m -> printfn "%s" m.Value)

// One car
// red car
// blue car

Short-cut common procedures to a single function

1:
2:
3:
4:
5:
6:
7:
8:

let groupNumberRegExp = @"COD(?<GroupNumber>[0-9]{3})END"
let groupNumberName = "GroupNumber"

sprintf "%s" "COD123END"
|> capture groupNumberRegExp groupNumberName
|> printfn "%s"

// 123

Natural Language Regular Expressions

The library also provides the composable Verbal Expressions language for constructing simple regular expressions in a readable fashion.

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:

open FsRegEx
open System.Text.RegularExpressions
open VerbalExpressions

let groupName =  "GroupNumber"

FsRegEx()
|> add "COD"
|> beginCaptureNamed groupName
|> any "0-9"
|> repeatPrevious 3
|> endCapture
|> then' "END"
|> capture "COD123END" groupName
|> printfn "%s"

// 123

A comparison of using Regex natively, and Verbal Expressions to retrieve the database parameter from a connection string:

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:

let TestConnString =
    """<add name="MyConnString" connectionString="Server=MyServer;Database=MyDatabase;User ID=me;Password=secret;Encrypt=True;TrustServerCertificate=True;Enlist=False;" />"""

let databaseFromRegex connectionString =

    Regex.Match(connectionString, "[dD]atabase=(?<database>.*?);").Groups.["database"].Value

let databaseFromFsRegEx connectionString =

    FsRegEx()
    |> add "[dD]atabase=(?<database>.*?);"
    |> capture connectionString "database"

(databaseFromRegex TestConnString) = (databaseFromFsRegEx TestConnString)
|> printfn "%b"

// true

This example shows the more verbose and descriptive Verbal Expressions:

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:

let databaseFromVerboseFsRegEx connectionString =

    FsRegEx()
    |> anyOf "dD"
    |> then' "atabase="
    |> beginCaptureNamed "database"
    |> add ".*?"
    |> endCapture
    |> then' ";"
    |> capture connectionString "database"

(databaseFromRegex TestConnString) = (databaseFromVerboseFsRegEx TestConnString)
|> printfn "%b"

// true

Documentation

FsRegEx comes with comprehensive API documentation and a tutorial.

API Reference contains documentation for all types, modules, and functions in the library.

F# Verbal Expressions Tutorial contains further explanation of the natural language DSL syntax and many more usage examples.

Versioning

FsRegEx adheres to Semantic Versioning. So long as the project is pre-1.0.0 minor versions may be breaking. Once the project reaches 1.0.0 minor enhancements will be backwards-compatible.

Contributing and copyright

FsRegEx is hosted on GitHub where you can report issues, fork
the project, and submit pull requests, so long as pull requests:

include excellent unit test coverage

include correct intellisense documentation

adhere to the concepts of composability

FsRegEx is available under Public Domain license, which allows modification and
redistribution for both commercial and non-commercial purposes. For more information see the
License file in the GitHub repository.

val carRegExp : string

val sprintf : format:Printf.StringFormat<'T> -> 'T

module Array

from Microsoft.FSharp.Collections

val iter : action:('T -> unit) -> array:'T [] -> unit

val m : obj

val printfn : format:Printf.TextWriterFormat<'T> -> 'T

val groupNumberRegExp : string

val groupNumberName : string

namespace System

namespace System.Text

namespace System.Text.RegularExpressions

val groupName : string

val TestConnString : string

val databaseFromRegex : connectionString:string -> string

val connectionString : string

Multiple items
type Regex =
  new : pattern:string -> Regex + 2 overloads
  member GetGroupNames : unit -> string[]
  member GetGroupNumbers : unit -> int[]
  member GroupNameFromNumber : i:int -> string
  member GroupNumberFromName : name:string -> int
  member IsMatch : input:string -> bool + 1 overload
  member Match : input:string -> Match + 2 overloads
  member MatchTimeout : TimeSpan
  member Matches : input:string -> MatchCollection + 1 overload
  member Options : RegexOptions
  ...

--------------------
Regex(pattern: string) : Regex
Regex(pattern: string, options: RegexOptions) : Regex
Regex(pattern: string, options: RegexOptions, matchTimeout: System.TimeSpan) : Regex

Regex.Match(input: string, pattern: string) : Match
Regex.Match(input: string, pattern: string, options: RegexOptions) : Match
Regex.Match(input: string, pattern: string, options: RegexOptions, matchTimeout: System.TimeSpan) : Match

val databaseFromFsRegEx : connectionString:'a -> 'b

val connectionString : 'a

val databaseFromVerboseFsRegEx : connectionString:'a -> 'b

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>On the Futility of Email Regex Validation
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

On the Futility of Email Regex Validation

Using regular expressions to validate email addresses is notoriously error prone.
The complexity of the address format specification makes constructing a machine readable
grammar correctly discerning the difference between valid and invalid addresses hard.

Evolution of the Internet Message Format

RFC 561 Standardizing Network Mail Headers, September 5, 1973

RFC 680 Message Transmission Protocol, April 30, 1975

RFC 724 Proposed Official Standard for the Format of ARPA Network Messages, May 12, 1977

RFC 733 STANDARD FOR THE FORMAT OF ARPA NETWORK TEXT MESSAGES, November 21, 1977

Obsoletes:  RFC 561, RFC 680, RFC 724

RFC 822 STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES, August 13, 1982

Obsoletes:  RFC 733

RFC 2822 Internet Message Format, April 2001

Obsoletes: RFC 822

RFC 5322 Internet Message Format, October 2008

Obsoletes: RFC 2822

Testing Regular Expressions that Parse Email Addresses

The tests are derived from a suite of tests available at RFC 822 Email Address Parser in PHP,
which we have converted to run under FsRegEx. The PHP parser author claims a much better success rate than we were able to achieve with
any regular expression, although still not perfect. The site also provides more background on the "muddy" internet specification.

The suite consists of 280 validataion tests, which we converted to Expecto tests
here. Run with the
Email.Tests console app.

We chose some email parsing regular expressions available on the internet for testing:

Simple, from emailregex.com.

Moderate, from emailregex.com.

Complex, from emailregex.com.

Ultimate, from
Mail::RFC822::Address: regexp-based address validation. This regular expression was machine generated.

Note that emailregex.com headlines "Email Address Regular Expression That 99.99% Works". The site offers many different
email address regular expressions. Apparently we never found the one that works 99.99% on our test suite.

We also tested a much simpler (non-regular expression) checker, that simply tests string for a single at sign that is not wrapped in quotes and is not either
the first or last character in the string here.

Results

Simple:

132 passed, 148 failed, 98 false negatives

Moderate:

190 passed, 90 failed, 72 false negatives

Complex:

172 passed, 108 failed, 60 false negatives

Ultimate:

170 passed, 110 failed, 11 false negatives

One At Sign:

162 passed, 118 failed, 1 false negative (test166)

Conclusion

The evolution of the Internet Email Address specification and way it is documented make it impossible to settle on a completely deterministic grammar covering all cases.
With that in mind it is already impossible to make any complete parser, let alone one based on a regular expression. That being said, the test results do not reflect
the likelihood of meeting any of the 280 test cases in the wild.

Simply determining if there is a correctly placed at sign is perhaps the best filter for most practical purposes, given the importance of this criterion.
(Note that even our attempt at rejecting multiple at signs resulted in a false negative.)

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>Matching
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

Matching

IsMatch

The System.Text.RegularExpressions.Regex Class provides several overloads of isMatch. The same overloads are available in the FsRegEx class and as individually
named functions, including overloads and functions using RegexOptions. Timeout is not supported at this time.

is match on first occurence

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:

open FsRegEx
module F = FsRegEx

let partNumbers = [| "1298-673-4192"; "A08Z-931-468A";
                    "_A90-123-129X"; "12345-KKA-1230";
                    "0919-2893-1256" |]

for partNumber in partNumbers do
    printfn "%s %s a valid part number."
        partNumber
        (if (F.isMatch @"^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$" partNumber ) then "is"
            else "is not")

let fsRegEx = new FsRegEx(@"^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$")

for partNumber in partNumbers do
    printfn "%s %s a valid part number."
        partNumber
        (if (fsRegEx.IsMatch(partNumber)) then "is"
            else "is not")

// 1298-673-4192 is a valid part number.
// A08Z-931-468A is a valid part number.
// _A90-123-129X is not a valid part number.
// 12345-KKA-1230 is not a valid part number.
// 0919-2893-1256 is not a valid part number.

is match starting at position

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:

let labeledPartNumbers = [| "Part Number: 1298-673-4192"; "Part No: A08Z-931-468A";
                        "_A90-123-129X"; "123K-000-1230";
                        "SKU: 0919-2893-1256" |]

for partNumber in labeledPartNumbers do
    let start = partNumber.IndexOf(':')
    if (start >= 0) then
        printfn "%s %s a valid part number."
            partNumber
            (if (F.isMatchAt @"^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$" start partNumber) then "is" else "is not")
    else
        printfn "Cannot find starting position in %s." partNumber

for partNumber in labeledPartNumbers do
    let start = partNumber.IndexOf(':')
    if (start >= 0) then
        printfn "%s %s a valid part number."
            partNumber
            (if (fsRegEx.IsMatch(partNumber, start)) then "is" else "is not")
    else
        printfn "Cannot find starting position in %s." partNumber

// Part Number: 1298-673-4192 is a valid part number.
// Part No: A08Z-931-468A is a valid part number.
// Cannot find starting position in _A90-123-129X.
// Cannot find starting position in 123K-000-1230.
// SKU: 0919-2893-1256 is not a valid part number.

FsMatch

FsMatch provides the functionality in the System.Text.RegularExpressions.Match Class, but returning arrays of objects instead of special collections.

iterate over matches

1:
2:
3:
4:
5:
6:

"Who writes these notes?"
|> FsRegEx.matches @"\b\w+es\b"
|> Array.iter (fun m -> printfn "Found '%s' at position %i" m.Value m.Index)

// Found 'writes' at position 4
// Found 'notes' at position 17

first match and iteration

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:

let regExpr = @"\b\w+es\b"
let sentence = "Who writes these notes and uses our paper?"

let m = FsRegEx.firstMatch regExpr sentence

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

// Found first 'es' in 'writes' at position 4
// Also found 'notes' at position 17
// Also found 'uses' at position 27

val partNumbers : string []

val partNumber : string

val printfn : format:Printf.TextWriterFormat<'T> -> 'T

val fsRegEx : obj

val labeledPartNumbers : string []

val start : int

System.String.IndexOf(value: string) : int
System.String.IndexOf(value: char) : int
System.String.IndexOf(value: string, comparisonType: System.StringComparison) : int
System.String.IndexOf(value: string, startIndex: int) : int
System.String.IndexOf(value: char, startIndex: int) : int
System.String.IndexOf(value: string, startIndex: int, comparisonType: System.StringComparison) : int
System.String.IndexOf(value: string, startIndex: int, count: int) : int
System.String.IndexOf(value: char, startIndex: int, count: int) : int
System.String.IndexOf(value: string, startIndex: int, count: int, comparisonType: System.StringComparison) : int

module Array

from Microsoft.FSharp.Collections

val iter : action:('T -> unit) -> array:'T [] -> unit

val m : obj

val regExpr : string

val sentence : string

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>license</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

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>Tutorial: F# Verbal Expressions
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

Tutorial: F# Verbal Expressions

The VerbalExpressions module includes the FsRegEx type which wraps the familiar .NET RegEx in a type with useful functional members.
Multiple constructors start with a regular expression in the constructor.

1:

let fsRegEx = new FsRegEx(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}")

This the module is an experimental DSL that allows you to compose regular expressions in natural language
using the immutable FsRegEx type. The remainder of this tutorial is concerned with the experimental DSL which is, frankly, not that practical.

For practical examples of using the core FsRegEx module for composability, see the following examples:

Matching

Matching Groups

Replace and Split

Capture

Verbal Expressions DSL

You can compose values of the FsRegEx type with the |> operator, including creating a new regular expression by logical or on 2 existing FsRegExs.

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:

#r "FsRegEx.dll"
open FsRegEx
open System.Text.RegularExpressions
open VerbalExpressions

let v =
    CommonFsRegEx.Email
    |> fsRegExOrFsRegEx RegexOptions.None CommonFsRegEx.Url

let foundEmail =
    v
    |> isMatch "test@github.com"

let foundUrl =
    v
    |> isMatch "http://www.google.com"

printfn "%b" foundEmail
printfn "%b" foundUrl

// true
// true

Natural language composition consists of building up a new FsRegEx from an old by functions which append special characters, groups, modifiers, and other attributes of the regular expression language.

function : 'T -> FsRegEx -> FsRegEx

See the API documentation for all the regular expression functions available.

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:

open VerbalExpressions

let foundFromGithub =
    FsRegEx()
    |> startOfLine
    |> something
    |> then' "github.com"
    |> endOfLine
    |> isMatch "test@github.com"

printfn "%b" foundFromGithub

// true

You do not have to worry about escaping special characters in your regular expression.

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:

let foundSomethingSpecial =
    FsRegEx()
    |> startOfLine
    |> something
    |> then' "*+?"
    |> anything
    |> isMatch "blah blah blah*+?yackety yack"

printfn "%b" foundSomethingSpecial

// true

Sometimes you may need more power than the natural language provides, or you just need to include a snippet of native regular expression. The add function lets you do that.

1:
2:
3:
4:
5:
6:
7:
8:
9:

let foundSpecialInMultiline =
    FsRegEx()
    |> add @"phrase1\*\+\?"
    |> anything
    |> isMatch @"phrase1*+?RestOfLine\n"

printfn "%b" foundSpecialInMultiline

// true

FsRegExs posses all the power of the .Net RegEx class in a composable form.

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:

let n =
    FsRegEx()
    |> word
    |> matches "three words here"

printfn "%i" n.Length

// 3

let betterFormat =
    FsRegEx()
    |> add "\s+"
    |> or' "whitespace"
    |> replace "This     is   text with   far  too   much   whitespace" " "

printfn "%s" betterFormat

// This is text with far too much

let groupName =  "GroupNumber"

FsRegEx()
|> add "COD"
|> beginCaptureNamed groupName
|> any "0-9"
|> repeatPrevious 3
|> endCapture
|> then' "END"
|> capture "COD123END" groupName
|> printfn "%s"

// 123

FsRegEx comes with first class support for unicode, including unicode general categories and .Net extension blocks.

1:
2:
3:
4:
5:
6:
7:
8:
9:

FsRegEx()
|> beginCaptureNamed "upper"
|> unicodeCategory Unicode.UnicodeGeneralCategory.LetterUppercase
|> add "+"
|> endCapture
|> capture "some mixed case WORDS" "upper"
|> printfn "%s"

// WORDS

val fsRegEx : obj

namespace System

namespace System.Text

namespace System.Text.RegularExpressions

val v : obj

type RegexOptions =
  | None = 0
  | IgnoreCase = 1
  | Multiline = 2
  | ExplicitCapture = 4
  | Compiled = 8
  | Singleline = 16
  | IgnorePatternWhitespace = 32
  | RightToLeft = 64
  | ECMAScript = 256
  | CultureInvariant = 512

field RegexOptions.None: RegexOptions = 0

val foundEmail : bool

val foundUrl : bool

val printfn : format:Printf.TextWriterFormat<'T> -> 'T

val foundFromGithub : bool

val foundSomethingSpecial : bool

val foundSpecialInMultiline : bool

val n : obj

val betterFormat : string

val groupName : string

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>Replacing and Splitting
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

Replacing and Splitting

Replace

The System.Text.RegularExpressions.Regex Class provides several overloads of replace. The same overloads are available in the FsRegEx class and as individually
named functions, including overloads and functions using RegexOptions. Timeout is not supported at this time.

simple replacement of all occurence

1:
2:
3:
4:
5:
6:
7:
8:
9:

open System
open System.Text.RegularExpressions

"This is   text with   far  too   much   " +
                "whitespace."
|> FsRegEx.replace "\\s+" " "
|>printfn "Replacement String: %s"

// Replacement String: This is text with far too much whitespace.

replace max time starting at

Replaces a specified maximum number of strings starting at location that match a regular expression pattern with a specified replacement string.

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:

"Instantiating a New Type\n" +
    "Generally, there are two ways that an\n" +
    "instance of a class or structure can\n" +
    "be instantiated. "
|> FsRegEx.replaceMaxTimesStartAtOpt "^.*$" RegexOptions.Multiline "\n$&"  -1 1
|> printfn "%s"

// Instantiating a New Type
//
// Generally, there are two ways that an
//
// instance of a class or structure can
//
// be instntiated.

replace with MatchEvaluator

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:

let capText (m : Match) =
    // Get the matched string.
    let x = m.Value
    // If the first char is lower case...
    if (Char.IsLower(x.[0])) then
        // Capitalize it.
        (Char.ToUpper(x.[0]).ToString()) + (x.Substring(1, x.Length - 1))
    else
        x

"four score and seven years ago"
|> FsRegEx.replaceByMatch @"\w+" (new MatchEvaluator(capText))
|> printfn "result=[%s]"

// result=[Four Score And Seven Years Ago]

Splitting

The System.Text.RegularExpressions.Regex Class provides several overloads of split to split strings into arrays. The same overloads are available in the FsRegEx class and as individually
named functions, including overloads and functions using RegexOptions. Timeout is not supported at this time.

split with Regex option

1:
2:
3:
4:
5:
6:
7:
8:
9:

"Abc1234Def5678Ghi9012Jklm"
|> FsRegEx.splitOpt "[a-z]+" RegexOptions.IgnoreCase
|> Array.iter (fun x -> printfn "'%s'" x)

// ''
// '1234'
// '5678'
// '9012'
// ''

namespace System

namespace System.Text

namespace System.Text.RegularExpressions

val printfn : format:Printf.TextWriterFormat<'T> -> 'T

type RegexOptions =
  | None = 0
  | IgnoreCase = 1
  | Multiline = 2
  | ExplicitCapture = 4
  | Compiled = 8
  | Singleline = 16
  | IgnorePatternWhitespace = 32
  | RightToLeft = 64
  | ECMAScript = 256
  | CultureInvariant = 512

field RegexOptions.Multiline: RegexOptions = 2

val capText : m:Match -> string

val m : Match

type Match =
  inherit Group
  member Groups : GroupCollection
  member NextMatch : unit -> Match
  member Result : replacement:string -> string
  static member Empty : Match
  static member Synchronized : inner:Match -> Match

val x : string

property Capture.Value: string

type Char =
  struct
    member CompareTo : value:obj -> int + 1 overload
    member Equals : obj:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member GetTypeCode : unit -> TypeCode
    member ToString : unit -> string + 1 overload
    static val MaxValue : char
    static val MinValue : char
    static member ConvertFromUtf32 : utf32:int -> string
    static member ConvertToUtf32 : highSurrogate:char * lowSurrogate:char -> int + 1 overload
    static member GetNumericValue : c:char -> float + 1 overload
    ...
  end

Char.IsLower(c: char) : bool
Char.IsLower(s: string, index: int) : bool

Char.ToUpper(c: char) : char
Char.ToUpper(c: char, culture: Globalization.CultureInfo) : char

String.Substring(startIndex: int) : string
String.Substring(startIndex: int, length: int) : string

property String.Length: int

type MatchEvaluator =
  delegate of Match -> string

field RegexOptions.IgnoreCase: RegexOptions = 1

type Array =
  member Clone : unit -> obj
  member CopyTo : array:Array * index:int -> unit + 1 overload
  member GetEnumerator : unit -> IEnumerator
  member GetLength : dimension:int -> int
  member GetLongLength : dimension:int -> int64
  member GetLowerBound : dimension:int -> int
  member GetUpperBound : dimension:int -> int
  member GetValue : [<ParamArray>] indices:int[] -> obj + 7 overloads
  member Initialize : unit -> unit
  member IsFixedSize : bool
  ...

val iter : action:('T -> unit) -> array:'T [] -> unit

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>Capture Groups
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

Capture Groups

FsGroup

FsGroup provides the functionality in the System.Text.RegularExpressions.Group Class, but returning arrays of objects instead of special collections and makes the group name a property.

anonymous groups

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:

let pattern = @"(\b(\w+?)[,:;]?\s?)+[?.!]"
let input = "This is one sentence. This is a second sentence."

let m = FsRegEx.firstMatch pattern input
printfn "Match: %s" m.Value

m.Groups()
|> Array.iteri (fun i g ->
    printfn "   Group %i: '%s'" i g.Value
    g.Captures()
    |> Array.iteri (fun i c ->
        printfn "      Capture %i: '%s'" i c.Value
        )
    )

// Match: This is one sentence.
//    Group 0: 'This is one sentence.'
//        Capture 0: 'This is one sentence.'
//    Group 1: 'sentence'
//        Capture 0: 'This '
//        Capture 1: 'is '
//        Capture 2: 'one '
//        Capture 3: 'sentence'
//    Group 2: 'sentence'
//        Capture 0: 'This'
//        Capture 1: 'is'
//        Capture 2: 'one'
//        Capture 3: 'sentence'

named groups

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:

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)

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

capturing groups

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:

let regExpr = @"\b(\w+?)([\u00AE\u2122])"

let matches =
    "Microsoft® Office Professional Edition combines several office " +
        "productivity products, including Word, Excel®, Access®, Outlook®, " +
        "PowerPoint®, and several others. Some guidelines for creating " +
        "corporate documents using these productivity tools are available " +
        "from the documents created using Silverlight™ on the corporate " +
        "intranet site."
    |> FsRegEx.matches regExpr

matches
|> Array.iter (fun m ->
    let groups = m.Groups()
    printfn "%s: %s" groups.[2].Value groups.[1].Value)

printfn ""
printfn "Found %i trademarks or registered trademarks." matches.Length

// ®: Microsoft
// ®: Excel
// ®: Access
// ®: Outlook
// ®: PowerPoint
// ™: Silverlight
//
// Found 6 trademarks or registered trademarks.

group numbers and names

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:

open System

let pattern'' = @"\b((?<word>\w+)\s*)+(?<end>[.?!])"
let input'' = "This is a sentence. This is a second sentence."

let groupNumbers' = FsRegEx.groupNumbers pattern''
let groupNames = FsRegEx.groupNames pattern''

let m'' = FsRegEx.firstMatch pattern'' input''

printfn "Match: %s" m''.Value

Array.zip groupNumbers' groupNames
|> Array.iter (fun (n, name) ->
    let isNumber, _ = Int32.TryParse(name)
    printfn "   Group %i%s: '%s'"
        n
        (if (not isNumber) then
            " (" + name + ")"
         else String.Empty)
        (m'.Groups()).[n].Value
    )

// Match: This is a sentence.
//    Group 0: 'This is a sentence.'
//    Group 1: 'sentence'
//    Group 2 (word): 'sentence'
//    Group 3 (end): '.'

val pattern : string

val input : string

val m : obj

val printfn : format:Printf.TextWriterFormat<'T> -> 'T

module Array

from Microsoft.FSharp.Collections

val iteri : action:(int -> 'T -> unit) -> array:'T [] -> unit

val i : int

val g : obj

val c : obj

val pattern' : string

val input' : string

val m' : obj

val iter : action:('T -> unit) -> array:'T [] -> unit

val regExpr : string

val matches : obj []

val groups : obj

property System.Array.Length: int

namespace System

val pattern'' : string

val input'' : string

val groupNumbers' : int []

val groupNames : string []

val m'' : obj

type Array =
  member Clone : unit -> obj
  member CopyTo : array:Array * index:int -> unit + 1 overload
  member GetEnumerator : unit -> IEnumerator
  member GetLength : dimension:int -> int
  member GetLongLength : dimension:int -> int64
  member GetLowerBound : dimension:int -> int
  member GetUpperBound : dimension:int -> int
  member GetValue : [<ParamArray>] indices:int[] -> obj + 7 overloads
  member Initialize : unit -> unit
  member IsFixedSize : bool
  ...

val zip : array1:'T1 [] -> array2:'T2 [] -> ('T1 * 'T2) []

val n : int

val name : string

val isNumber : bool

type Int32 =
  struct
    member CompareTo : value:obj -> int + 1 overload
    member Equals : obj:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member GetTypeCode : unit -> TypeCode
    member ToString : unit -> string + 3 overloads
    static val MaxValue : int
    static val MinValue : int
    static member Parse : s:string -> int + 3 overloads
    static member TryParse : s:string * result:int -> bool + 1 overload
  end

Int32.TryParse(s: string, result: byref<int>) : bool
Int32.TryParse(s: string, style: Globalization.NumberStyles, provider: IFormatProvider, result: byref<int>) : bool

val not : value:bool -> bool

Multiple items
type String =
  new : value:char -> string + 7 overloads
  member Chars : int -> char
  member Clone : unit -> obj
  member CompareTo : value:obj -> int + 1 overload
  member Contains : value:string -> bool
  member CopyTo : sourceIndex:int * destination:char[] * destinationIndex:int * count:int -> unit
  member EndsWith : value:string -> bool + 2 overloads
  member Equals : obj:obj -> bool + 2 overloads
  member GetEnumerator : unit -> CharEnumerator
  member GetHashCode : unit -> int
  ...

--------------------
String(value: nativeptr<char>) : String
String(value: nativeptr<sbyte>) : String
String(value: char []) : String
String(c: char, count: int) : String
String(value: nativeptr<char>, startIndex: int, length: int) : String
String(value: nativeptr<sbyte>, startIndex: int, length: int) : String
String(value: char [], startIndex: int, length: int) : String
String(value: nativeptr<sbyte>, startIndex: int, length: int, enc: Text.Encoding) : String

field string.Empty: string

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>Capturing
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Composable F# regular expressions."/>
    <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

Capturing

Capturing is a shortcut through matching to a named group or the group's captured value.

capture

1:
2:
3:
4:
5:
6:
7:
8:
9:

open FsRegEx

let groupNumberRegExp = @"COD(?<GroupNumber>[0-9]{3})END"
let groupNumberName = "GroupNumber"

capture groupNumberRegExp groupNumberName "COD123END"
|> printfn "%s"

// 123

capture group

1:
2:
3:
4:
5:

let group = captureGroup groupNumberRegExp groupNumberName "COD123END"

printfn "%s" group.Value

// 123

val groupNumberRegExp : string

val groupNumberName : string

val printfn : format:Printf.TextWriterFormat<'T> -> 'T

val group : obj

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:
@import url(https://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans+Mono|Open+Sans:400,600,700);

/*--------------------------------------------------------------------------
  Formatting for F# code snippets
/*--------------------------------------------------------------------------*/

/* identifier */
span.i { color:#000000; }
/* string */
span.s { color:#a31515; }
/* keywords */
span.k { color:#0000ff; }
/* comment */
span.c { color:#008000; }
/* operators */
span.o { color:#000000; }
/* numbers */
span.n { color:#000000; }
/* line number */
span.l { color:#96c2cd; }
/* type or module */
span.t { color:#2b91af; }
/* function */
span.f { color:#0000a0; }
/* DU case or active pattern */
span.p { color:#800080; }
/* mutable var or ref cell */
span.v { color:#000000; font-weight: bold; }
/* printf formatters */
span.pf { color:#2b91af; }
/* escaped chars */
span.e { color:#ff0080; }
/* mutable var or ref cell */

/* inactive code */
span.inactive { color:#808080; }
/* preprocessor */
span.prep { color:#0000ff; }
/* fsi output */
span.fsi { color:#808080; }

/* omitted */
span.omitted {
	background:#3c4e52;
  border-radius:5px;
	color:#808080;
	padding:0px 0px 1px 0px;
}
/* tool tip */
div.tip {
	background:#e5e5e5;
  border-radius:4px;
  font:9pt 'Droid Sans', arial, sans-serif;
	padding:6px 8px 6px 8px;
	display:none;
  color:#000000;
  pointer-events:none;
}
table.pre pre {
  padding:0px;
  margin:0px;
  border:none;
}
table.pre, pre.fssnip, pre {
  line-height:13pt;
  border:1px solid #d8d8d8;
  border-collapse:separate;
  white-space:pre;
  font: 10pt consolas,monospace;
  width:90%;
  margin:10px 20px 20px 20px;
  background-color:#fdfdfd;
  padding:10px;
  border-radius:5px;
  color:#000000;
  max-width: none;
}
pre.fssnip code {
  font: 9pt 'Droid Sans Mono',consolas,monospace;
}
table.pre pre {
  padding:0px;
  margin:0px;
  border-radius:0px;
  width: 100%;
}
table.pre td {
  padding:0px;
  white-space:normal;
  margin:0px;
}
table.pre td.lines {
  width:30px;
}

/*--------------------------------------------------------------------------
  Formatting for page & standard document content
/*--------------------------------------------------------------------------*/

body {
  font-family: 'Open Sans', serif;
  padding-top: 0px;
  padding-bottom: 40px;
}

pre {
    word-wrap: inherit;
}

/* Format the heading - nicer spacing etc. */
.masthead {
  overflow: hidden;
}
.masthead .muted a {
  text-decoration:none;
  color:#999999;
}
.masthead ul, .masthead li {
  margin-bottom:0px;
}
.masthead .nav li {
  margin-top: 15px;
  font-size:110%;
}
.masthead h3 {
  margin-bottom:5px;
  font-size:170%;
}
hr {
  margin:0px 0px 20px 0px;
}

/* Make table headings and td.title bold */
td.title, thead {
  font-weight:bold;
}

/* Format the right-side menu */
#menu {
  margin-top:50px;
  font-size:11pt;
  padding-left:20px;
}

#menu .nav-header {
  font-size:12pt;
  color:#606060;
  margin-top:20px;
}

#menu li {
  line-height:25px;
}

/* Change font sizes for headings etc. */
#main h1 { font-size: 26pt; margin:10px 0px 15px 0px; font-weight:400; }
#main h2 { font-size: 20pt; margin:20px 0px 0px 0px; font-weight:400; }
#main h3 { font-size: 14pt; margin:15px 0px 0px 0px; font-weight:600; }
#main p  { font-size: 11pt; margin:5px 0px 15px 0px; }
#main ul { font-size: 11pt; margin-top:10px; }
#main li { font-size: 11pt; margin: 5px 0px 5px 0px; }
#main strong { font-weight:700; }

/*--------------------------------------------------------------------------
  Formatting for API reference
/*--------------------------------------------------------------------------*/

.type-list .type-name, .module-list .module-name {
  width:25%;
  font-weight:bold;
}
.member-list .member-name {
  width:35%;
}
#main .xmldoc h2 {
  font-size:14pt;
  margin:10px 0px 0px 0px;
}
#main .xmldoc h3 {
  font-size:12pt;
  margin:10px 0px 0px 0px;
}
.github-link {
  float:right;
  text-decoration:none;
}
.github-link img {
  border-style:none;
  margin-left:10px;
}
.github-link .hover { display:none; }
.github-link:hover .hover { display:block; }
.github-link .normal { display: block; }
.github-link:hover .normal { display: none; }

/*--------------------------------------------------------------------------
  Links
/*--------------------------------------------------------------------------*/

h1 a, h1 a:hover, h1 a:focus,
h2 a, h2 a:hover, h2 a:focus,
h3 a, h3 a:hover, h3 a:focus,
h4 a, h4 a:hover, h4 a:focus,
h5 a, h5 a:hover, h5 a:focus,
h6 a, h6 a:hover, h6 a:focus { color : inherit; text-decoration : inherit; outline:none }

/*--------------------------------------------------------------------------
  Additional formatting for the homepage
/*--------------------------------------------------------------------------*/

#nuget {
  margin-top:20px;
  font-size: 11pt;
  padding:20px;
}

#nuget pre {
  font-size:11pt;
  -moz-border-radius: 0px;
  -webkit-border-radius: 0px;
  border-radius: 0px;
  background: #404040;
  border-style:none;
  color: #e0e0e0;
  margin-top:15px;
}


text:
@import url(https://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans+Mono|Open+Sans:400,600,700);

/*--------------------------------------------------------------------------
  Formatting for F# code snippets
/*--------------------------------------------------------------------------*/

/* strings --- and stlyes for other string related formats */
span.s { color:#E0E268; }
/* printf formatters */
span.pf { color:#E0C57F; }
/* escaped chars */
span.e { color:#EA8675; }

/* identifiers --- and styles for more specific identifier types */
span.id { color:#d1d1d1; }
/* module */
span.m { color:#43AEC6; }
/* reference type */
span.rt { color:#43AEC6; }
/* value type */
span.vt { color:#43AEC6; }
/* interface */
span.if{ color:#43AEC6; }
/* type argument */
span.ta { color:#43AEC6; }
/* disposable */
span.d { color:#43AEC6; }
/* property */
span.prop { color:#43AEC6; }
/* punctuation */
span.p { color:#43AEC6; }
/* function */
span.f { color:#e1e1e1; }
/* active pattern */
span.pat { color:#4ec9b0; }
/* union case */
span.u { color:#4ec9b0; }
/* enumeration */
span.e { color:#4ec9b0; }
/* keywords */
span.k { color:#FAB11D; }
/* comment */
span.c { color:#808080; }
/* operators */
span.o { color:#af75c1; }
/* numbers */
span.n { color:#96C71D; }
/* line number */
span.l { color:#80b0b0; }
/* mutable var or ref cell */
span.v { color:#d1d1d1; font-weight: bold; }
/* inactive code */
span.inactive { color:#808080; }
/* preprocessor */
span.prep { color:#af75c1; }
/* fsi output */
span.fsi { color:#808080; }

/* omitted */
span.omitted {
	background:#3c4e52;
  border-radius:5px;
	color:#808080;
	padding:0px 0px 1px 0px;
}
/* tool tip */
div.tip {
	background:#475b5f;
  border-radius:4px;
  font:11pt 'Droid Sans', arial, sans-serif;
	padding:6px 8px 6px 8px;
	display:none;
  color:#d1d1d1;
  pointer-events:none;
}
table.pre pre {
  padding:0px;
  margin:0px;
  border:none;
}
table.pre, pre.fssnip, pre {
  line-height:13pt;
  border:1px solid #d8d8d8;
  border-collapse:separate;
  white-space:pre;
  font: 9pt 'Droid Sans Mono',consolas,monospace;
  width:90%;
  margin:10px 20px 20px 20px;
  background-color:#212d30;
  padding:10px;
  border-radius:5px;
  color:#d1d1d1;
  max-width: none;
}
pre.fssnip code {
  font: 9pt 'Droid Sans Mono',consolas,monospace;
}
table.pre pre {
  padding:0px;
  margin:0px;
  border-radius:0px;
  width: 100%;
}
table.pre td {
  padding:0px;
  white-space:normal;
  margin:0px;
}
table.pre td.lines {
  width:30px;
}

/*--------------------------------------------------------------------------
  Formatting for page & standard document content
/*--------------------------------------------------------------------------*/

body {
  font-family: 'Open Sans', serif;
  padding-top: 0px;
  padding-bottom: 40px;
}

pre {
    word-wrap: inherit;
}

/* Format the heading - nicer spacing etc. */
.masthead {
  overflow: hidden;
}
.masthead .muted a {
  text-decoration:none;
  color:#999999;
}
.masthead ul, .masthead li {
  margin-bottom:0px;
}
.masthead .nav li {
  margin-top: 15px;
  font-size:110%;
}
.masthead h3 {
  margin-bottom:5px;
  font-size:170%;
}
hr {
  margin:0px 0px 20px 0px;
}

/* Make table headings and td.title bold */
td.title, thead {
  font-weight:bold;
}

/* Format the right-side menu */
#menu {
  margin-top:50px;
  font-size:11pt;
  padding-left:20px;
}

#menu .nav-header {
  font-size:12pt;
  color:#606060;
  margin-top:20px;
}

#menu li {
  line-height:25px;
}

/* Change font sizes for headings etc. */
#main h1 { font-size: 26pt; margin:10px 0px 15px 0px; font-weight:400; }
#main h2 { font-size: 20pt; margin:20px 0px 0px 0px; font-weight:400; }
#main h3 { font-size: 14pt; margin:15px 0px 0px 0px; font-weight:600; }
#main p  { font-size: 11pt; margin:5px 0px 15px 0px; }
#main ul { font-size: 11pt; margin-top:10px; }
#main li { font-size: 11pt; margin: 5px 0px 5px 0px; }
#main strong { font-weight:700; }

/*--------------------------------------------------------------------------
  Formatting for API reference
/*--------------------------------------------------------------------------*/

.type-list .type-name, .module-list .module-name {
  width:25%;
  font-weight:bold;
}
.member-list .member-name {
  width:35%;
}
#main .xmldoc h2 {
  font-size:14pt;
  margin:10px 0px 0px 0px;
}
#main .xmldoc h3 {
  font-size:12pt;
  margin:10px 0px 0px 0px;
}
.github-link {
  float:right;
  text-decoration:none;
}
.github-link img {
  border-style:none;
  margin-left:10px;
}
.github-link .hover { display:none; }
.github-link:hover .hover { display:block; }
.github-link .normal { display: block; }
.github-link:hover .normal { display: none; }

/*--------------------------------------------------------------------------
  Links
/*--------------------------------------------------------------------------*/

h1 a, h1 a:hover, h1 a:focus,
h2 a, h2 a:hover, h2 a:focus,
h3 a, h3 a:hover, h3 a:focus,
h4 a, h4 a:hover, h4 a:focus,
h5 a, h5 a:hover, h5 a:focus,
h6 a, h6 a:hover, h6 a:focus { color : inherit; text-decoration : inherit; outline:none }

/*--------------------------------------------------------------------------
  Additional formatting for the homepage
/*--------------------------------------------------------------------------*/

#nuget {
  margin-top:20px;
  font-size: 11pt;
  padding:20px;
}

#nuget pre {
  font-size:11pt;
  -moz-border-radius: 0px;
  -webkit-border-radius: 0px;
  border-radius: 0px;
  background: #404040;
  border-style:none;
  color: #e0e0e0;
  margin-top:15px;
}


text:
var currentTip = null;
var currentTipElement = null;

function hideTip(evt, name, unique) {
    var el = document.getElementById(name);
    el.style.display = "none";
    currentTip = null;
}

function findPos(obj) {
    // no idea why, but it behaves differently in webbrowser component
    if (window.location.search == "?inapp")
        return [obj.offsetLeft + 10, obj.offsetTop + 30];

    var curleft = 0;
    var curtop = obj.offsetHeight;
    while (obj) {
        curleft += obj.offsetLeft;
        curtop += obj.offsetTop;
        obj = obj.offsetParent;
    };
    return [curleft, curtop];
}

function hideUsingEsc(e) {
    if (!e) { e = event; }
    hideTip(e, currentTipElement, currentTip);
}

function showTip(evt, name, unique, owner) {
    document.onkeydown = hideUsingEsc;
    if (currentTip == unique) return;
    currentTip = unique;
    currentTipElement = name;

    var pos = findPos(owner ? owner : (evt.srcElement ? evt.srcElement : evt.target));
    var posx = pos[0];
    var posy = pos[1];

    var el = document.getElementById(name);
    var parent = (document.documentElement == null) ? document.body : document.documentElement;
    el.style.position = "absolute";
    el.style.left = posx + "px";
    el.style.top = posy + "px";
    el.style.display = "block";
}


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>UnicodeGeneralCategory - 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

UnicodeGeneralCategory

    Namespace: global

        Parent Module: Unicode

Enum Unicode defined general categories

Union Cases

Union Case	Description

            ControlAll

            Signature:

All control characters. This includes the OtherControl, OtherFormat, OtherSurrogate, OtherPrivateUse, and OtherNotAssigned categories; C

            Letter

            Signature:

All letter characters. This includes the LetterUppercase, LetterLowercase, LetterTitlecase, LetterModifier, and LetterOther characters; L

            LetterLowercase

            Signature:

Letter, Lowercase; Ll

            LetterModifier

            Signature:

Letter, Modifier; Lm

            LetterOther

            Signature:

Letter, Other; Lo

            LetterTitlecase

            Signature:

Letter, Titlecase; Lt

            LetterUppercase

            Signature:

Letter, Uppercase; Lu

            Mark

            Signature:

All diacritic marks. This includes the MarkNonspacing, MarkSpacingCombining, and MarkEnclosing categories; M

            MarkEnclosing

            Signature:

Mark, Enclosing; Me

            MarkNonspacing

            Signature:

Mark, Nonspacing; Mn

            MarkSpacingCombining

            Signature:

Mark, Spacing Combining; Mc

            NumberALL

            Signature:

All numbers. This includes the Nd, Nl, and No categories; N

            NumberDecimalDigit

            Signature:

Number, Decimal Digit; Nd

            NumberLetter

            Signature:

Number, Letter; Nl

            NumberOther

            Signature:

Number, Other; No

            OtherControl

            Signature:

Other, Control; Cc

            OtherFormat

            Signature:

Other, Format; Cf

            OtherNotAssigned

            Signature:

Other, Not Assigned (no characters have this property); Cn

            OtherPrivateUse

            Signature:

Other, Private Use; Co

            OtherSurrogate

            Signature:

Other, Surrogate; Cs

            Punctuation

            Signature:

All punctuation characters. This includes the PunctuationConnector, PunctuationDash, PunctuationOpen, PunctuationClose, PunctuationInitial, PunctuationFinal, and PunctuationOther categories; P

            PunctuationClose

            Signature:

Punctuation, Close; Pe

            PunctuationConnector

            Signature:

Punctuation, Connector; Pc

            PunctuationDash

            Signature:

Punctuation, Dash; Pd

            PunctuationFinal

            Signature:

Punctuation, Final quote (may behave like Ps or Pe depending on usage); Pf

            PunctuationInitial

            Signature:

Punctuation, Initial quote (may behave like Ps or Pe depending on usage); Pi

            PunctuationOpen

            Signature:

Punctuation, Open; Ps

            PunctuationOther

            Signature:

Punctuation, Other; Po

            Separator

            Signature:

All separator characters. This includes the SeparatorSpace, SeparatorLine, and SeparatorLine categories; Z

            SeparatorLine

            Signature:

Separator, Line; Zl

            SeparatorParagraph

            Signature:

Separator, Paragraph; Zp

            SeparatorSpace

            Signature:

Separator, Space; Zs

            Symbol

            Signature:

All symbols. This includes the SymbolMath, SymbolCurrency, SymbolModifier, and SymbolOther categories; S

            SymbolCurrency

            Signature:

Symbol, Currency; Sc

            SymbolMath

            Signature:

Symbol, Math; Sm

            SymbolModifier

            Signature:

Symbol, Modifier; Sk

            SymbolOther

            Signature:

Symbol, Other; So

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

        Parent Module: FsRegEx

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

Constructors

Constructor	Description

            new(...)

            Signature: (regularExpression:string * regexOptions:RegexOptions * matchTimeout:TimeSpan) -> FsRegEx

CompiledName: .ctor

            new(regularExpression, regexOptions)

            Signature: (regularExpression:string * regexOptions:RegexOptions) -> FsRegEx

CompiledName: .ctor

            new(regularExpression)

            Signature: regularExpression:string -> FsRegEx

CompiledName: .ctor

            new(regexOptions)

            Signature: regexOptions:RegexOptions -> FsRegEx

CompiledName: .ctor

            new()

            Signature: unit -> FsRegEx

CompiledName: .ctor

Instance members

Instance member	Description

            Capture(input arg2)

            Signature: input:string -> string -> string

Match and select groupname value.

            GroupNameFromNumber(n)

            Signature: n:int -> string option

Gets the group name that corresponds to the specified group number.

            GroupNames()

            Signature: unit -> string array

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

            GroupNumberFromName(groupName)

            Signature: groupName:string -> int option

Returns the group number that corresponds to the specified group name.

            GroupNumbers()

            Signature: unit -> int array

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

            IsMatch(input, startAt)

            Signature: (input:string * startAt:int) -> bool

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

            IsMatch(input)

            Signature: input:string -> bool

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

            Match(input, startAt, length)

            Signature: (input:string * startAt:int * length:int) -> FsMatch

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

            Match(input, startAt)

            Signature: (input:string * startAt:int) -> FsMatch

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

            Match(input)

            Signature: input:string -> FsMatch

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

            Matches(input, startAt)

            Signature: (input:string * startAt:int) -> FsMatch []

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

            Matches(input)

            Signature: input:string -> FsMatch []

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

            MatchTimeout

            Signature: TimeSpan

Gets the time-out interval of the current instance.

CompiledName: get_MatchTimeout

            Regex

            Signature: Regex

The underlying System.Text.RegularExpressions.Regex

CompiledName: get_Regex

            RegexOptions

            Signature: RegexOptions

Enumerated values to use to set regular expression options.

CompiledName: get_RegexOptions

            Replace(input, evalutor, count, startAt)

            Signature: (input:string * evalutor:MatchEvaluator * 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.

            Replace(...)

            Signature: (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 regular expression with replacement string.

            Replace(input, evalutor, count)

            Signature: (input:string * evalutor:MatchEvaluator * count:int) -> string

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

            Replace(input, replacement, count)

            Signature: (input:string * replacement:string * count:int) -> string

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

            Replace(input, evalutor)

            Signature: (input:string * evalutor:MatchEvaluator) -> string

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

            Replace(input, replacement)

            Signature: (input:string * replacement:string) -> string

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

            RightToLeft

            Signature: bool

Indicates whether the regular expression searches from right to left.

CompiledName: get_RightToLeft

            Split(input, count, startAt)

            Signature: (input:string * count:int * startAt:int) -> 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.

            Split(input, count)

            Signature: (input:string * count:int) -> string array

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

            Split(input)

            Signature: input:string -> string array

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

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>Namespaces - 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

global Namespace

Module	Description

            CommonFsRegEx

Common regular expressions in FsRegEx type.

            FsRegEx

Types and functions supporting composable F# regular expressions.

            VerbalExpressions

Functions supporting composable verbal expression natural language regular expressions.

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>CommonFsRegEx - 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

CommonFsRegEx

  Namespace: global

Common regular expressions in FsRegEx type.

Functions and values

Function or value	Description

            Email

            Signature: FsRegEx

Valid email string. (Note that RE email validation is ill-advised.)

            Url

            Signature: FsRegEx

Valid Url string.

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>FsMatch - 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

FsMatch

    Namespace: global

        Parent Module: FsRegEx

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

Constructors

Constructor	Description

            new(regex, fsMatch)

            Signature: (regex:Regex * fsMatch:Match) -> FsMatch

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.

            Groups()

            Signature: unit -> FsGroup []

Capturing groups matched by regular expression.

            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

            Match

            Signature: Match

Wrapped System.Text.RegularExpressions.Match. Represents the results from a single regular expression match.

CompiledName: get_Match

            Result(replacement)

            Signature: replacement:string -> string

Returns the expansion of the specified replacement pattern.

            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>SupportedNamedBlock - 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

SupportedNamedBlock

    Namespace: global

        Parent Module: Unicode

Enum .NET Framework named Unicode blocks

Union Cases

Union Case	Description

            IsAlphabeticPresentationForms

            Signature:

FB00 - FB4F

            IsArabic

            Signature:

0600 - 06FF

            IsArabicPresentationFormsA

            Signature:

FB50 - FDFF

            IsArabicPresentationFormsB

            Signature:

FE70 - FEFF

            IsArmenian

            Signature:

0530 - 058F

            IsArrows

            Signature:

2190 - 21FF

            IsBasicLatin

            Signature:

0000 - 007F

            IsBengali

            Signature:

0980 - 09FF

            IsBlockElements

            Signature:

2580 - 259F

            IsBopomofo

            Signature:

3100 - 312F

            IsBopomofoExtended

            Signature:

31A0 - 31BF

            IsBoxDrawing

            Signature:

2500 - 257F

            IsBraillePatterns

            Signature:

2800 - 28FF

            IsBuhid

            Signature:

1740 - 175F

            IsCherokee

            Signature:

13A0 - 13FF

            IsCJKCompatibility

            Signature:

3300 - 33FF

            IsCJKCompatibilityForms

            Signature:

FE30 - FE4F

            IsCJKCompatibilityIdeographs

            Signature:

F900 - FAFF

            IsCJKRadicalsSupplement

            Signature:

2E80 - 2EFF

            IsCJKSymbolsandPunctuation

            Signature:

3000 - 303F

            IsCJKUnifiedIdeographs

            Signature:

4E00 - 9FFF

            IsCJKUnifiedIdeographsExtensionA

            Signature:

3400 - 4DBF

            IsCombiningDiacriticalMarks

            Signature:

0300 - 036F

            IsCombiningDiacriticalMarksforSymbols

            Signature:

20D0 - 20FF

            IsCombiningHalfMarks

            Signature:

FE20 - FE2F

            IsCombiningMarksforSymbols

            Signature:

20D0 - 20FF

            IsControlPictures

            Signature:

2400 - 243F

            IsCurrencySymbols

            Signature:

20A0 - 20CF

            IsCyrillic

            Signature:

0400 - 04FF

            IsCyrillicSupplement

            Signature:

0500 - 052F

            IsDevanagari

            Signature:

0900 - 097F

            IsDingbats

            Signature:

2700 - 27BF

            IsEnclosedAlphanumerics

            Signature:

2460 - 24FF

            IsEnclosedCJKLettersandMonths

            Signature:

3200 - 32FF

            IsEthiopic

            Signature:

1200 - 137F

            IsGeneralPunctuation

            Signature:

2000 - 206F

            IsGeometricShapes

            Signature:

25A0 - 25FF

            IsGeorgian

            Signature:

10A0 - 10FF

            IsGreek

            Signature:

0370 - 03FF

            IsGreekandCoptic

            Signature:

0370 - 03FF

            IsGreekExtended

            Signature:

1F00 - 1FFF

            IsGujarati

            Signature:

0A80 - 0AFF

            IsGurmukhi

            Signature:

0A00 - 0A7F

            IsHalfwidthandFullwidthForms

            Signature:

FF00 - FFEF

            IsHangulCompatibilityJamo

            Signature:

3130 - 318F

            IsHangulJamo

            Signature:

1100 - 11FF

            IsHangulSyllables

            Signature:

AC00 - D7AF

            IsHanunoo

            Signature:

1720 - 173F

            IsHebrew

            Signature:

0590 - 05FF

            IsHighPrivateUseSurrogates

            Signature:

DB80 - DBFF

            IsHighSurrogates

            Signature:

D800 - DB7F

            IsHiragana

            Signature:

3040 - 309F

            IsIdeographicDescriptionCharacters

            Signature:

2FF0 - 2FFF

            IsIPAExtensions

            Signature:

0250 - 02AF

            IsKanbun

            Signature:

3190 - 319F

            IsKangxiRadicals

            Signature:

2F00 - 2FDF

            IsKannada

            Signature:

0C80 - 0CFF

            IsKatakana

            Signature:

30A0 - 30FF

            IsKatakanaPhoneticExtensions

            Signature:

31F0 - 31FF

            IsKhmer

            Signature:

1780 - 17FF

            IsKhmerSymbols

            Signature:

19E0 - 19FF

            IsLao

            Signature:

0E80 - 0EFF

            IsLatin1Supplement

            Signature:

0080 - 00FF

            IsLatinExtendedA

            Signature:

0100 - 017F

            IsLatinExtendedAdditional

            Signature:

1E00 - 1EFF

            IsLatinExtendedB

            Signature:

0180 - 024F

            IsLetterlikeSymbols

            Signature:

2100 - 214F

            IsLimbu

            Signature:

1900 - 194F

            IsLowSurrogates

            Signature:

DC00 - DFFF

            IsMalayalam

            Signature:

0D00 - 0D7F

            IsMathematicalOperators

            Signature:

2200 - 22FF

            IsMiscellaneousMathematicalSymbolsA

            Signature:

27C0 - 27EF

            IsMiscellaneousMathematicalSymbolsB

            Signature:

2980 - 29FF

            IsMiscellaneousSymbols

            Signature:

2600 - 26FF

            IsMiscellaneousSymbolsandArrows

            Signature:

2B00 - 2BFF

            IsMiscellaneousTechnical

            Signature:

2300 - 23FF

            IsMongolian

            Signature:

1800 - 18AF

            IsMyanmar

            Signature:

1000 - 109F

            IsNumberForms

            Signature:

2150 - 218F

            IsOgham

            Signature:

1680 - 169F

            IsOpticalCharacterRecognition

            Signature:

2440 - 245F

            IsOriya

            Signature:

0B00 - 0B7F

            IsPhoneticExtensions

            Signature:

1D00 - 1D7F

            IsPrivateUse

            Signature:

E000 - F8FF

            IsRunic

            Signature:

16A0 - 16FF

            IsSinhala

            Signature:

0D80 - 0DFF

            IsSmallFormVariants

            Signature:

FE50 - FE6F

            IsSpacingModifierLetters

            Signature:

02B0 - 02FF

            IsSpecials

            Signature:

FFF0 - FFFF

            IsSuperscriptsandSubscripts

            Signature:

2070 - 209F

            IsSupplementalArrowsA

            Signature:

27F0 - 27FF

            IsSupplementalArrowsB

            Signature:

2900 - 297F

            IsSupplementalMathematicalOperators

            Signature:

2A00 - 2AFF

            IsSyriac

            Signature:

0700 - 074F

            IsTagalog

            Signature:

1700 - 171F

            IsTagbanwa

            Signature:

1760 - 177F

            IsTaiLe

            Signature:

1950 - 197F

            IsTamil

            Signature:

0B80 - 0BFF

            IsTelugu

            Signature:

0C00 - 0C7F

            IsThaana

            Signature:

0780 - 07BF

            IsThai

            Signature:

0E00 - 0E7F

            IsTibetan

            Signature:

0F00 - 0FFF

            IsUnifiedCanadianAboriginalSyllabics

            Signature:

1400 - 167F

            IsVariationSelectors

            Signature:

FE00 - FE0F

            IsYijingHexagramSymbols

            Signature:

4DC0 - 4DFF

            IsYiRadicals

            Signature:

A490 - A4CF

            IsYiSyllables

            Signature:

A000 - A48F

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>VerbalExpressions - 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

VerbalExpressions

  Namespace: global

Functions supporting composable verbal expression natural language regular expressions.

Functions and values

Function or value	Description

            add value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

Append unescaped literal expression to the expression.

            any value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

Same as anyOf.

            anyOf value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

Matches any single character included in the specified set of escaped characters; [value]

            anything fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Zero or more of any character; (.*)

            anythingBut value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

Zero or more of any character except escaped character(s); ([^value]*)

            backReference ordinal fsRegEx

            Signature: ordinal:int -> fsRegEx:FsRegEx -> FsRegEx

Refers to nth occurence of capturing groups; \ordinal

            beginCapture fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Begin capture group; (

            beginCaptureNamed groupName fsRegEx

            Signature: groupName:string -> fsRegEx:FsRegEx -> FsRegEx

Begin named capture group ;(?<groupName>

            br fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Same as lineBreak; \n

            capture input groupName fsRegEx

            Signature: input:string -> groupName:string -> fsRegEx:FsRegEx -> string

Match and select groupname value.

            digit fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Matches any decimal digit; \d

            endCapture fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

End capture group; )

            endOfLine fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Mark the expression to end at the last character of the line; $

            exists f fsRegEx

            Signature: f:(FsRegEx -> bool) -> fsRegEx:FsRegEx -> bool

Evaluates the boolean function on the FsRegEx

            find value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

Append escaped literal expression to the expression. (Same as then'.)

            firstMatch input fsRegEx

            Signature: input:string -> fsRegEx:FsRegEx -> FsMatch

Searches the specified input string for the first occurrence of the FsRegEx.

            fold f state fsRegEx

            Signature: f:('State -> FsRegEx -> 'State) -> state:'State -> fsRegEx:FsRegEx -> 'State

                          Type parameters: 'State

Applies a function to a FsRegEx and a state returning a state

            foldBack f fsRegEx state

            Signature: f:(FsRegEx -> 'State -> 'State) -> fsRegEx:FsRegEx -> state:'State -> 'State

                          Type parameters: 'State

Applies a function to a FsRegEx and a state returning a state

            fsRegExOrFsRegEx (...)

            Signature: regexOptions:RegexOptions -> fsRegEx:FsRegEx -> fsRegEx:FsRegEx -> FsRegEx

Return new FsRegEx of two FsRegExs or'ed.

            groupNames fsRegEx

            Signature: fsRegEx:FsRegEx -> string array

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

            groupNumbers fsRegEx

            Signature: fsRegEx:FsRegEx -> int array

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

            isMatch value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> bool

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

            isMatchAt value startAt fsRegEx

            Signature: value:string -> startAt:int -> fsRegEx:FsRegEx -> bool

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

            iter f fsRegEx

            Signature: f:(FsRegEx -> unit) -> fsRegEx:FsRegEx -> unit

Executes a function on a FsRegEx.

            lineBreak fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Matches universal line break expression; \n

            map f fsRegEx

            Signature: f:(FsRegEx -> FsRegEx) -> fsRegEx:FsRegEx -> FsRegEx

Transforms a FsRegEx  with a mapping function

            matchAt input startAt fsRegEx

            Signature: input:string -> startAt:int -> fsRegEx:FsRegEx -> FsMatch

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

            matchAtFor input startAt length fsRegEx

            Signature: input:string -> startAt:int -> length:int -> fsRegEx:FsRegEx -> FsMatch

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

            matches input fsRegEx

            Signature: input:string -> fsRegEx:FsRegEx -> FsMatch []

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

            matchesAt input startAt fsRegEx

            Signature: input:string -> startAt:int -> fsRegEx:FsRegEx -> FsMatch []

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

            maybe value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

Add escaped string to the expression that might appear once (or not); (value)?

            multiple value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

The escaped expression 1 or more times; (value)+

            multipleFsRegEx sourceFsRegEx fsRegEx

            Signature: sourceFsRegEx:FsRegEx -> fsRegEx:FsRegEx -> FsRegEx

The FsRegEx 1 or more times; (sourceFsRegEx)+

            namedBackReference groupname fsRegEx

            Signature: groupname:string -> fsRegEx:FsRegEx -> FsRegEx

Refers to named capturing group; \k<groupname>

            namedBlock name arg2

            Signature: name:SupportedNamedBlock -> FsRegEx -> FsRegEx

Matches any single character in the supported named block; \p{name}

            nonDigit fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Matches any nondigit; \D

            nonWhiteSpace fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Matches any non-white-space character; \S.

            nonWordCharacter fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Matches any nonword character; \W

            notNamedBlock name arg2

            Signature: name:SupportedNamedBlock -> FsRegEx -> FsRegEx

Matches any single character that is not in the supported named block; \P{name}

            notUnicodeCategory category arg2

            Signature: category:UnicodeGeneralCategory -> FsRegEx -> FsRegEx

Matches any single character that is not in the Unicode general category; \P{name}

            or' regularExpression fsRegEx

            Signature: regularExpression:string -> fsRegEx:FsRegEx -> FsRegEx

Or's the regular expression to the regular expression in a FsRegEx.

            range collection fsRegEx

            Signature: collection:seq<obj> -> fsRegEx:FsRegEx -> FsRegEx

Add expression to match a range (or multiple ranges), unescaped values.

            repeatBetweenPrevious n m arg3

            Signature: n:int -> m:int -> FsRegEx -> FsRegEx

Repeat previous number of times between n and m; {n,m}

            repeatPrevious n arg2

            Signature: n:int -> FsRegEx -> FsRegEx

Repeat previous exact number of times; {n}

            replace input replacement fsRegEx

            Signature: input:string -> replacement:string -> fsRegEx:FsRegEx -> string

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

            replaceByMatch input evalutor fsRegEx

            Signature: input:string -> evalutor:MatchEvaluator -> fsRegEx:FsRegEx -> string

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

            replaceByMatchMaxTimes (...)

            Signature: input:string -> evalutor:MatchEvaluator -> 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.

            replaceByMatchMaxTimesStartAt (...)

            Signature: input:string -> evalutor:MatchEvaluator -> 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.

            replaceMaxTimes (...)

            Signature: input:string -> replacement:string -> count:int -> fsRegEx:FsRegEx -> string

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

            replaceMaxTimesStartAt (...)

            Signature: 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 regular expression with replacement string.

            resetRegexOptions (...)

            Signature: newRegexOptions:RegexOptions option -> fsRegEx:FsRegEx -> FsRegEx

Return new FsRegEx with new RegExOptions.

            something fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

One or more of any character; (.+)

            somethingBut value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

One or more of any character except escaped character; ([^%s]+)

            split input fsRegEx

            Signature: input:string -> fsRegEx:FsRegEx -> string array

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

            splitMaxTimes input count fsRegEx

            Signature: input:string -> count:int -> fsRegEx:FsRegEx -> string array

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

            splitMaxTimesStartAt (...)

            Signature: input:string -> count:int -> startAt:int -> fsRegEx:FsRegEx -> 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.

            startOfLine fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Mark the expression to start at the beginning of the line; ^

            tab fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Matches a tab character; \t

            then' value fsRegEx

            Signature: value:string -> fsRegEx:FsRegEx -> FsRegEx

Append escaped literal expression to the expression. (Same as find.)

            toString fsRegEx

            Signature: fsRegEx:FsRegEx -> string

Value of regular expression.

            unicode nnnn arg2

            Signature: nnnn:string -> FsRegEx -> FsRegEx

Matches a Unicode character by using hexadecimal representation  (exactly four digits, as represented by nnnn); \unnnn

            unicodeCategory category arg2

            Signature: category:UnicodeGeneralCategory -> FsRegEx -> FsRegEx

Matches any single character in the Unicode general category; \p{name}

            whiteSpace fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Matches any white-space character; \s

            word fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Expression to match a word; \w+

            wordCharacter fsRegEx

            Signature: fsRegEx:FsRegEx -> FsRegEx

Matches any word character; \w

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