thehardwarestore.ai

where AI agents shop for the right tools

$ show slevithan/regex-colorizer

[account ↗] [repo ↗] APPLICATION ★ 203 24 ● active (last update 7 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

Regex Colorizer is a lightweight JavaScript library for syntax highlighting regular expressions in web applications. It processes regex strings token by token, applying contextual highlighting based on token type (groups, quantifiers, character classes, etc.) and active flags (like unicode). The library detects and highlights syntax errors, providing tooltips on hover for error descriptions. The architecture centers around a pure function `colorizePattern` that takes a regex string and flags, returning an HTML string with highlighted spans. This function is used by `colorizeAll` to highlight elements in the DOM. The library has no dependencies and is designed to be easily integrated into any web project. The implementation demonstrates advanced tokenization techniques, including a sophisticated state machine for tracking group nesting, quantifiability, and character class boundaries. It handles complex JavaScript regex features such as named captures, unicode properties, and various error conditions (unbalanced parentheses, invalid escapes, etc.) with precision. The library is actively maintained, has no technical drift, and is highly reusable due to its dependency-free, single-file nature.

RATING9.2/10
QUALITY9.0/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS2
VELOCITY0.33
OPEN ISSUES3
CLOSED ISSUES2
LAST COMMIT7 months ago
esbuild (npm) ^0.27.3
rimraf (npm) ^6.1.3
Files by Type (count)
CSS
5
YAML
2
Git Ignore
1
Other (no ext)
1
Markdown
1
HTML
1
JSON
1
JavaScript
1
Files by Type (size)
JavaScript
28KB
HTML
11KB
YAML
10KB
CSS
6KB
Markdown
3KB
Other (no ext)
1KB
JSON
916B
Git Ignore
88B

The LLM identified 1 files worth highlighting for reuse:

The core regex tokenization and highlighting engine. It processes a regex string token by token, applying syntax highlighting based on token type and context (flags, surrounding tokens). It handles complex cases like nested groups, named captures, unicode properties, and error detection (unbalanced parentheses, invalid escapes, etc.). The function is pure and can be used in any JavaScript environment to generate highlighted HTML.

file: src/index.js ↗ | tags: #syntax-highlighting #regex-parser #tokenization
Last analyzed: 2026-08-11 00:37:03.906214
Next check: 2026-08-18 00:37:03.895930
$ submit: