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

regexp overview

Added in v0.4.4


Table of contents


RegExpC (interface)

Signature

export interface RegExpC extends t.Type<RegExp, RegExp, unknown> {}

Added in v0.4.4

regexp

Signature

export const regexp: RegExpC = ...

Example

import { regexp } from 'io-ts-types/lib/regexp'
import { right } from 'fp-ts/lib/Either'

const input1 = /\w+/
const input2 = new RegExp('\\w+')
assert.deepStrictEqual(regexp.decode(input1), right(input1))
assert.deepStrictEqual(regexp.decode(input2), right(input2))

Added in v0.4.4