.*
VALIDATORE JS & TS

Validatore Regex per JavaScript

Esegui pattern ECMAScript RegExp direttamente nel browser. Evidenziazione in tempo reale e generazione codice TypeScript.

JavaScript RegExp Sandbox
Flags:
//giu
RegExp.test(str) === true
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/giu;
const isValid = regex.test(input);
const matches = [...input.matchAll(regex)];

JavaScript Regular Expressions in Modern Browsers & Node.js

Our js regex validator and regex playground validator allows rapid testing of ECMAScript standard regular expressions directly inside modern V8, JavaScriptCore, and SpiderMonkey engines.

Modern Flags (/u and /v)

Always enable Unicode mode (/u or the new ES2024 /v flag) when handling multi-byte UTF-16 code points like emojis or international names.

Lookahead & Lookbehind

Modern JavaScript fully supports positive lookaheads (?=...), negative lookaheads (?!...), positive lookbehinds (?<=...), and negative lookbehinds (?<!...).

JavaScript Regex Validation FAQ

How do I test a regular expression in JavaScript?

Use RegExp.prototype.test(string) for boolean checks: const isValid = /^[a-z]+$/i.test(input); or String.prototype.match(regex) to extract capturing groups.

What is the difference between RegExp /g and /y (sticky) flags?

The /g (global) flag searches for all matches throughout the entire string, updating lastIndex after each find. The /y (sticky) flag only attempts to match strictly at the exact index indicated by the lastIndex property.

How does unicode property escapes (\p{...}) work in modern JS regex?

When using the /u or /v flag, \p{...} allows matching characters based on Unicode properties: for example /\p{Letter}+/u matches letters in any language (English, Arabic, Cyrillic, Chinese, etc.).