Skip to main content

A from-scratch regular expression engine with TUI

Project description

Regecks

A regex engine built from scratch using python, and a TUI using Textual!

Ever part of this including stuff like the lexer, parser, the ast, and the backtracking were written by hand :)

Installation

Requires uv

git clone https://github.com/kashsuks/regecks
cd regecks
uv sync

Running

uv run regecks

Keybindings

Key Action
Tab Move between pattern and test string fields
Ctrl+R Run match manually
Ctrl+C Quit

Matches get updated live

Supported Syntax

Literals

Pattern Match
a The character a
abc The string abc exactly

Wildcard

Pattern Match
. Any single character except newline

Quantifiers

All quantifiers are greedy and therefore consume as much as possible.

Pattern Match
a* Zero or more a
a+ One or more a
a? Zero or one a
a{3} Exactly 3 a
a{2,} 2 or more a
a{2,4} Between 2 and 4 a (inclusive)

Anchors

Pattern Match
^abc abc only at the start of the string
abc$ abc only at the end of the string
\b Word boundary (between \w and \W)
\B Non-word boundary

Character classes

Pattern Match
[abc] Any one of a, b, or c
[a-z] Any lowercase letter
[A-Z0-9] Any uppercase letter or digit
[^abc] Any character except a, b, c
[^0-9] Any non-digit

Escape sequences

Pattern Match
\d Any digit [0-9]
\D Any non-digit
\w Any word character [a-zA-Z0-9_]
\W Any non-word character
\s Any whitespace (space, tab, newline, etc)
\S Any non-whitespace
\n Newline
\t Tab
\n Literal dot (escaping special chars)

Alternation

Pattern Match
cat|dog Either cat or dog
foo|bar|baz Any of the three

Groups

Pattern Match
(abc) abc, captured as group 1
(a)(b) ab, with a as group 1 and b as group 2
(?:abc) abc, not captured
(?Pabc) abc, captured as named group name

Flags

Pattern Match
(?iabc) Match abc case-insensitively and matches ABC, abc, etc.

The flags wrap everything that follows it in a pattern

Lookahead and lookbehind

These are zero-width assertions meaning they check for a condition without consuming characters.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regecks-0.1.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

regecks-0.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file regecks-0.1.0.tar.gz.

File metadata

  • Download URL: regecks-0.1.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for regecks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e09014a73c24a67b23cb313c5a94df40ce268432b1bfad5c22ae3666d01281e
MD5 5806cf775671a75d3e48cdae526fead5
BLAKE2b-256 ee95265d932a52259572b598c4d3fe6fd09931fb234e085ca2859aede9cc7970

See more details on using hashes here.

File details

Details for the file regecks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: regecks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for regecks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9926315c8c4b09ff51f46892f00ef765e41a22c4882ea8b6cedfa8cfd3f46f61
MD5 1dea4bb8fc65b926f30c46b92830a3ae
BLAKE2b-256 3b017c61e5ea2d9b8945886abfd856bc97e7849620536957dccfff03b333ac3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page