Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
A wildcard matches all characters except line terminators. It also matches line terminators if the s flag is set.
. matches any character except line terminators. If the s flag is set, . also matches line terminators.
The exact character set matched by . depends on whether the regex is Unicode-aware. If it is Unicode-aware, . matches any Unicode code point; otherwise, it matches any UTF-16 code unit. For example:
Wildcards are often used with quantifiers to match any character sequence, until the next character of interest is found. For example, the following example extracts the title of a Markdown page in the form # Title:
The following example matches the content of a code block enclosed by three backticks in Markdown. It uses the s flag to make . match line terminators, because the content of a code block may span multiple lines:
Warning: These examples are for demonstration only. If you want to parse Markdown, use a dedicated Markdown parser because there are many edge cases to consider.
| ECMAScript® 2027 Language Specification # prod-Atom |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.