/../.test("😄"); // true; matches two UTF-16 code units as a surrogate pair
/../u.test("😄"); // false; input only has one Unicode characterWildcard: . / notebook
Wildcard: .
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
function parseTitle(entry) {
// Use multiline mode because the title may not be at the start of
// the file. Note that the m flag does not make . match line
// terminators, so the title must be on a single line
// Return text matched by the first capturing group.
return /^#[ \t]+(.+)$/m.exec(entry)?.[1];
}
parseTitle("# Hello world"); // "Hello world"
parseTitle("## Subsection"); // undefined
parseTitle(`
---
slug: Web/JavaScript/Reference/Regular_expressions/Wildcard
---
# Wildcard: .
A **wildcard** matches all characters except line terminators.
`); // "Wildcard: ."function parseCodeBlock(entry) {
return /^