RegExp editor

Write a regular expression — matches highlight in real time, and every token in the pattern is explained below. Plus a library of ready-made expressions for email, phones, dates, IPs and other common cases.

01Editor02Breakdown03Examples04About05Questions06Related
01

Editor and highlighting

Pattern
//
Matches found: 2
Test text
Контакты: [email protected] и [email protected] Телефоны: +7 (495) 123-45-67, 8-800-555-00-11 Дата: 14.03.2026, 2026-03-14 IP-адреса: 192.168.1.1, 10.0.0.255 Цены: 1 490 руб., $29.99, €14,90 Хэши: a1b2c3d4, 0xDEADBEEF
02

Token-by-token breakdown

every character in the pattern — with its purpose
\b
Граница слова
Нулевая позиция между символом слова и несловесным символом
\w
Символ слова
Буква (a-z, A-Z), цифра или подчёркивание. [a-zA-Z0-9_]
+
Жадные 1+
1 или более повторений — требует хотя бы одного совпадения
@
Литеральный символ
Совпадает ровно с символом «@»
\w
Символ слова
Буква (a-z, A-Z), цифра или подчёркивание. [a-zA-Z0-9_]
+
Жадные 1+
1 или более повторений — требует хотя бы одного совпадения
\.
Экранированный символ
Литеральный символ «.» — экранирование убирает специальное значение
\w
Символ слова
Буква (a-z, A-Z), цифра или подчёркивание. [a-zA-Z0-9_]
{2,}
Минимум N раз
N или более повторений
\b
Граница слова
Нулевая позиция между символом слова и несловесным символом
03

Library of ready-made expressions

click an example — pattern and test text will load
Email
/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g
Телефон РФ
/(?:\+7|8)[\s\-]?\(?\d{3}\)?[\s\-]?\d{3}[\s\-]?\d{2}[\s\-]?\d{2}/g
Телефон международный
/\+[1-9]\d{0,2}[\s\-]?\(?\d{1,4}\)?[\s\-]?\d{1,4}[\s\-]?\d{1,9}/g
URL
/https?:\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:/~+#]*[\w\-@?^=%&/~+#])?/gi
04

About regular expressions

RegExp syntax

JS flavour
/pattern/flags · new RegExp('p', 'g')
Regular expressions — a mini-language for pattern search and replace. JavaScript uses its own dialect (PCRE-inspired). Key parts: anchors (^ $ \b), classes (\d \w \s . [ ]), quantifiers (* + ? {n,m}), groups (( ) (?: )), alternation (|).

Flags

gimsuy
g · global · i · ignore case · m · multiline
g — find all matches, not just the first. i — case-insensitive. m — ^ and $ work per line. s — dot matches \n. u — Unicode. y — sticky (only from lastIndex). Flags combine: /.../gim.

Greedy vs lazy

Backtracking
.* — greedy · .*? — lazy
Quantifiers are greedy by default — they grab as much as possible. Add ? to make them lazy — they take the minimum. Classic example: .* in /<.*>/ on '<a><b>' captures '<a><b>', while .*? — only '<a>'. For parsing HTML use a proper parser.

Watch performance

ReDoS
(a+)+ on 'aaaaX' — exponential
Some patterns can hang on millions of backtracking iterations (a ReDoS attack). Nested quantifiers like (a+)+ or (a|a)* are dangerous. Write atomic patterns and test on long inputs. In safety-critical places use RE2 (Go, Google) which has no backtracking.
05

Frequently asked questions

Type the pattern and some sample text — matches highlight as you type and appear in a list with a counter beside it. A broken pattern does not break the page: instead of highlighting you get the engine's own message about what it objected to. Below that, the pattern is broken into tokens with an explanation of each.

Updated

«» added to favorites