Interface RegExp

Index

Methods

Methods

public addFlag(flag: string): RegExp

Adds to the regex.

example

/texty/.addFlag('g') -> now has global flag set

Parameters

  • flag: string

    RegExp flag to add.

Returns

RegExp

RegExp with added.

public getFlags(): string

Returns the flags of the regex as a string.

example

/texty/gim.getFlags('testy') -> 'gim'

Returns

string

RegExp flags.

public removeFlag(flag: string): RegExp

Removes from the regex.

example

/texty/g.removeFlag('g') -> now has global flag removed

Parameters

  • flag: string

    RegExp flag to remove.

Returns

RegExp

RegExp with flag removed.

public setFlags(flags: string): RegExp

Sets the flags on a regex and retuns a copy.

example

/texty/.setFlags('gim') -> now has global, ignoreCase, and multiline set

Parameters

  • flags: string

    Set the RegExp to have these flags.

Returns

RegExp

Copy of RegExp with .