JavaScript RegExp compile() method

The RegExp compile() method has been deprecated since 1999.

Avoid using it.

It may stop running at any time in your browser.

Definition and Usage

The compile() method is not recommended in JavaScript version 1.5.

This method is used to compile regular expressions during script execution.

Syntax

regexp.compile(regexp, modifier)

Parameter

Parameter Description
regexp Regular Expression.
modifier

Specify the type of match.

  • "g" means global matching
  • "i" means case-insensitive matching
  • "gi" means global case-insensitive matching