JS: Create Regex Object
Regex Literal Expression
/regex/flags
This is convenient.
If you have slash character in regex pattern, you need to add backslash in front to escape it.
Regex constructor
RegExp(str, flagsStr)
This is more general, and can be used to construct regex from string at runtime.
JavaScript. Regular Expression
- JS: Regular Expression Tutorial
- JS: Regular Expression Functions
- JS: Create Regex Object
- JS: Regular Expression Syntax
- JS: Regular Expression Flags
- JS: Regex Replace String Dollar Sign
- JS: Regex Replace Function Args
- JS: RegExp (class)
- JS: RegExp Constructor
- JS: RegExp.prototype
- JS: String.prototype.search
- JS: String.prototype.match
- JS: String.prototype.matchAll
- JS: String.prototype.replace
- JS: String.prototype.replaceAll
- JS: RegExp.prototype.test
- JS: RegExp.prototype.exec