Skip to main content Link Search Menu Expand Document (external link)

RegExp overview

Very simple regular expression module


Table of contents


Constructors

fromRegExpString

Creates a RegExp from a string

Signature

export declare const fromRegExpString: (flags?: string) => (s: string) => RegExp

Destructors

match

A slightly different version of match using RegExp.prototype.exec instead of String.prototype.match. This function will always return only the first match, even if the g flag is set. Good to use in a library when you have no control over the RegExp you receive.

Signature

export declare const match: (s: string) => (self: RegExp) => Option.Option<string>

matchAndGroups

Same as match but also returns capturing groups.

Signature

export declare const matchAndGroups: (s: string) => (self: RegExp) => Option.Option<RegExpExecArray>

Instances

binaryIntAtStart

A regular expression representing a string starting with an integer in base 2.

Signature

export declare const binaryIntAtStart: RegExp

email

A regular expression representing an email

Signature

export declare const email: RegExp

globalLineBreak

A regular expression representing a linebreak in all systems with the g flag. ATTENTION: MUST NOT BE USED WITH exec or test because these functions will modify the lastIndex property of this global RegExp

Signature

export declare const globalLineBreak: RegExp

hexaIntAtStart

A regular expression representing a string starting with an integer in base 16.

Signature

export declare const hexaIntAtStart: RegExp

lineBreak

A regular expression representing a linebreak in all systems without the g flag.

Signature

export declare const lineBreak: RegExp

nonZeroDigit

A regular expression representing a strictly positive digit

Signature

export declare const nonZeroDigit: RegExp

octalIntAtStart

A regular expression representing a string starting with an integer in base 8.

Signature

export declare const octalIntAtStart: RegExp

semVer

A regular expression representing a SemVer

Signature

export declare const semVer: RegExp

universalPathSep

A regular expression representing a path separator that will match on all systems

Signature

export declare const universalPathSep: RegExp