Форматирование JSON
Форматирование JSON для удобного чтения.
Проверка шаблонов, групп и замен.
JavaScript regular expressions. Processing runs in a worker and stops after 3 seconds. Quick reference: \d digit, \w word, \s whitespace, + one or more, * zero or more, ^ start, $ end.
Подробные методы и примеры доступны на английском.
The browser executes JavaScript RegExp semantics in a dedicated worker. Match details include text, zero-based UTF-16 indexes, captured groups, and named groups. The replacement string follows JavaScript replacement conventions, including $1 and named references.
The pattern \d+ with flag g finds 12 and 34 in order 12, item 34. A worker timeout stops patterns that take too long.
Develop a pattern for text extraction or cleanup before adding it to an application. Testing both matching and nonmatching examples helps catch a pattern that works on one sample but accepts too much.
Check the global g flag if you intend to find repeated matches. Other flags such as i and m affect case sensitivity and line boundaries rather than enabling all matches.
Indexes are zero-based UTF-16 positions, matching JavaScript string indexing. Some visible symbols occupy multiple code units, so the index can differ from a visual character count.