Skip to content

Alternative Regex Syntax

Franklin Yu edited this page Sep 26, 2024 · 41 revisions

This page lists projects that provide an alternative to traditional regex syntax, e.g. POSIX [[:digit:]]+ or Perl \d+.

It's freely editable, so please add your projects here.

Related: Alternative Shells

Regex / Regular Language Projects

  • Oil's Egg Expressions
    • Translates to POSIX ERE for use with grep, awk, sed
    • Literal strings are quoted; operators are unquoted / unescaped
    • Reuse and composition of of patterns
  • Structural Regular Expressions - The current UNIX text processing tools are weakened by the built-in concept of a line. There is a simple notation that can describe the `shape' of files when the typical array-of-lines picture is inadequate. When operations using these expressions are composed, the result is reminiscent of shell pipelines. Structural expressions were originally implemented in the command language for Plan 9's sam text editor, and later in acme. More recently it has been used in vis.
  • Verbal Expressions - A JavaScript library that helps to construct difficult regular expressions. Also ported to many languages.
  • kleenexp - modern regular expression syntax everywhere with a painless upgrade path
  • SRL - Simple Regex Language. Regular Expressions Made Simple (Hacker News Comments)
  • Melody - Melody is a language that compiles to regular expressions and aims to be more easily readable and maintainable (Hacker News Comments)
  • Pomsky (formerly Rulex) - A new, portable, regular expression language. Hacker News comments in June 2022 and December 2022, Lobster
  • Super Expressive - A zero-dependency JavaScript library for building regular expressions in (almost) natural language (Hacker News Comments)
  • Re - An OCaml regular expression library, in addition to Perl, Posix, Emacs, Shell and PCRE syntax, it supports writing regexps using declarative higher level combinators
  • Tyre - A set of combinators to write type-safe regular expressions, allowing automatic extraction and modification of matched groups. In Ocaml, bidirectional
  • Raku Grammars
    • Literal strings are quoted; operators are unquoted / unescaped
  • Lua's Patterns - Lua's pattern-matching is a (deliberate) subset of what POSIX regular expressions can do. As Roberto Ierusalimschy writes in Programming in Lua: "The main reason for this decision is size: a typical implementation of POSIX regular expressions takes more than 4000 lines of code, which is more than half the size of all Lua standard libraries together. In comparison, the implementation of pattern matching in Lua has less than 600 lines" (77, 4th edition).
  • Wolfram String Patterns -- The Wolfram Language's symbolic string patterns provide a compact yet readable basis for sophisticated string operations. Included directly in programs, or symbolically generated on the fly, ...
  • MUMPS Pattern Match Operator - Circa 1967, present in the 1977 ANSI MUMPS language standard.
  • Remake - A Rust library and programming language for composing regular expressions
  • Edify - A Python library that allows you to easily create regular expressions for matching text in a programmatically-friendly way. It also allows you to verify a string quickly by providing commonly used regex patterns in its extensive set of built-in patterns.
  • sgrep - structured grep is a tool for searching and indexing text, SGML, XML and HTML files and filtering text streams using structural criteria. The data model of sgrep is based on regions, which are nonempty substrings of text. See Region Expressions
  • REXS - a language that compiles to regular expressions, and a JavaScript library as the compiler.
  • natural-regex - a JavaScript library to compose regular expression

Lisp-Like Syntax

Parsing Libraries

Parsing Expression Grammars

Parser Combinators

Links

Clone this wiki locally