JavaScript Regexp_basics Guide
Regular expressions define search patterns for string matching, validation, and text extraction. The guide walks through Creating Regex. Literal: `/pattern/flags`. Constructor: `new RegExp("pattern", "flags")`. Flags: g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode), y (sticky). `.test(str)` — boolean match. `.exec(str)` — match result with groups. `str.match(regex)` — array of matches. `str.replace(regex, replacement)` — substitute. `str.search(regex)` — index of match. The guide is organized into 1 sections that build on each other, each pairing a prose explanation with runnable code. Related guides: Arrays, Strings, Numbers, Math, Date. This is one of 145 JavaScript guides on JS Reference — see the full list on the guides page. Practice what you learn in the JavaScript playground, and look up any unfamiliar term in the JavaScript glossary.