Verified Production Fix
[nodejs/node] Broken perf map when newline in RegExp with Node24
GH-nodejs/node#62131 • Mar 08, 2026
### ROOT CAUSE
The issue arises because the Node.js 24 perf map does not correctly handle newlines in regular expression symbols. Specifically, the newline character `\n` is not being properly escaped or handled, leading to the symbol being split across multiple lines in the perf map.
### CODE FIX
To address this issue, you can escape the newline character in the regular expression symbol. This ensures that the entire symbol is treated as a single line in the perf map.
Here is the modified code:
js
// repro.js
const re = new RegExp("HELLO\\nWORLD", "sy");
const str = "HELLO\nWORLD";
for (let i = 0; i < 100_000; i++) {
re.lastIndex = 0;
re.exec(str);
}
By replacing `\n` with `\\n`, the newline character is correctly escaped, and the perf map should display the symbol as a single line.
Deploy with Vultr
Use this fix in production instantly. Claim your high-performance developer credit.
Get Started with Vultr →
digital