Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS

JS Tutorial

JS Syntax

JS Operators

JS If Conditions

JS Loops

JS Strings

JS Numbers

JS Functions

JS Objects

JS Scope

JS Dates

JS Temporal  New

JS Arrays

JS Sets

JS Maps

JS Iterations

JS Math

JS RegExp

JS Data Types

JS Errors

JS Debugging

JS Style Guide

JS Reference

JS Projects New

JS 2026

JS HTML DOM

JS HTML Events


JS Advanced


JS Functions

JS Objects

JS Classes

JS Asynchronous

JS Modules

JS Meta & Proxy

JS Typed Arrays

JS DOM Navigation

JS Windows

JS Web API

JS AJAX

JS JSON

JS jQuery

JS Graphics

JS Examples

JS Reference


RegExp Methods


Complete RexExp Reference

Revised July 2025

Name Description
compile() Compiles a regular expression (Deprecated)
constructor Returns the function that created the RegExp prototype
dotAll Returns true if the s flag is set in the expression
(new in 2018)
escape() Returns a string where characters that belongs to the regular expression syntax are escaped
(new in 2025)
exec() Returns a result array for a matches in a string
flags Returns the modifiers set in the expression
(new in 2015)
global Returns true if the g flag is set in the expression
hasIndices Returns true if the d flag is set (new in 2022)
ignoreCase Returns true if the i flag is set
lastIndex Specifies the index at which to start the next match
multiline Returns true if the m modifier is set
source Returns the text of the RegExp pattern
sticky Returns true if the y flag is set
(new in 2015)
test() Tests for a match in a string. Returns true or false
toString() Returns the string value of the regular expression
unicode Returns true if the u flag is set
(new in 2018)
unicodeSets Returns true if the v flag is set
(new in 2023)

RegExp String Methods

MethodDescription
match(regexp) Returns an Array of results
matchAll(regexp) Returns an Iterator of results
replace(regexp, s) Returns a new String
replaceAll(regexp, s) Returns a new String
search(regexp) Returns the index of the first match
split(regexp) Returns an Array of results



×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.

-->