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
capturedGroups
Same as matchAndGroups but returns only the captured groups.
Signature
export declare const capturedGroups: <N extends number>(
s: string,
capturingGroupNumber: N
) => MTypes.OneArgFunction<RegExp, Option.Option<MTypes.Tuple<string, N>>>
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: <N extends number>(
s: string,
capturingGroupNumber: N
) => (self: RegExp) => Option.Option<[match: string, capturingGroups: MTypes.Tuple<string, N>]>
Instances
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.
Signature
export declare const globalLineBreak: () => RegExp
lineBreak
A regular expression representing a linebreak in all systems without the g
flag.
Signature
export declare const lineBreak: 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