Comparison with other projects

This wiki has a list of projects with similar goals to Pomsky. Here’s a list of the most popular projects:

ProjectTypesGitHub
MelodyTranspiledGitHub stars melody
PomskyTranspiledGitHub stars pomsky
Egg ExpressionsTranspiled
App: Oil shell
Rx ExpressionsTranspiled
App: Emacs
Raku GrammarsApp: Raku
RosieApp: Rosie
SRLDSL: PHPGitHub stars SRL-PHP
Super ExpressiveDSL: JSGitHub stars super-expressive
Verbal ExpressionsDSL: JSGitHub stars JSVerbalExpressions
Swift RegexBuilderDSL: Swift

Since this content is likely to get out of date, I encourage you to update it.

Types

Transpiled

These languages are transpiled to “normal” regular expressions and can therefore be used anywhere. They usually have command-line interface to compile expressions.

Application specific

Some regex languages are specific to a certain application or programming language. For example, Raku grammars can only be used in Raku; egg expressions are transpiled, but they are only available in the Oil shell.

DSLs

DSLs (domain-specific languages) are languages that are embedded in another language using the host language’s syntax. For example, Verbal Expressions uses JavaScript methods:

const tester = VerEx()
  .startOfLine()
  .then('http')
  .maybe('s')
  .then('://')
  .maybe('www.')
  .anythingBut(' ')
  .endOfLine()

This page currently only discusses transpiled languages, but I welcome contributions.

Compatibility

Let’s see what Regex flavors are supported by transpiled languages.

FlavorMelodyPomskyEgg Expr.Rx Expr.
ERE
ECMAScript
PCRE*
.NET*
Java*
Ruby*
Python
Rust

*Melody can only emit ECMAScript regexes, but they also happen to be compatible with several other flavors.

Explanation of the flavors

  • ERE (extended regular expressions) are used by tools such as GNU grep and awk. Because ERE supports only the most basic features, it is mostly forward compatible with other regex flavors.

  • ECMAScript is the syntax used in JavaScript and related languages (TypeScript, Elm, Dart, etc.) that are compiled to JS.

  • PCRE (an acronym for “Perl compatible regular expression”) is the syntax used by the PCRE2 regex engine, which is the default in at least Crystal, Delphi, Elixir, Erlang, Hack, Julia, PHP, R and Vala. It’s also a popular choice in other languages like C and C++ and is used in many applications such as the Apache server, nginx, MariaDB, MongoDB, and optionally in GNU grep.

  • .NET refers to the Regex class in .NET languages such as C# and F#.

  • Java refers to the Pattern class in Java’s standard library. Equivalent to Kotlin’s and Scala’s regular expressions.

  • Ruby refers to built-in regular expressions in Ruby.

  • Python refers to Pythons re module. Note that Python 3 is required for good Unicode support.

  • Rust refers to Rust’s popular regex crate (used by ripgrep)

Many more flavors exist, which are not (or only partially) supported by Pomsky and other languages.

Features

Let’s see what Regex features are supported by languages that are transpiled to regular expressions.

Basic regex features

FeatureMelodyPomskyEgg Expr.Rx Expr.
Greedy repetition
Lazy repetition
Dot
Character escape
Character class
Anchor
Word boundary
Negated word boundary
Character rangepartly*
Character set
Negated character setpartly*
Capturing group
Alternation
POSIX class
Non-capturing group

*Character ranges and negated sets in Melody only support ASCII letters, digits and a few special characters.

Advanced features

FeatureMelodyPomskyEgg Expr.Rx Expr.
Variable/macro
Line comment
Block comment
Code point
Lookaround
Named capturing group
Backreference
Named backreference
Relative backreference
Unicode category
Unicode script/blockpartly
Other Unicode property
Any code pointpartly*partly*partly*
Any grapheme
Atomic group
Character set intersection
Character set subtraction
Possessive quantifier
Conditional
Recursion
Modifier
Inline regex
Optimizationsome**

Note that Melody and Pomsky support inline regexes. Because of this, all Regex features are technically supported in Melody and Pomsky, but using inline regexes may be less ergonomic and more dangerous to use than properly supported features.

*All languages can match a code point with the dot, if multiline mode is enabled in the regex engine.

**Pomsky can currently optimize repetitions, remove redundant or empty groups and deduplicate code points in character sets. More optimizations are planned.

Tooling

ToolMelodyPomskyEgg Expr.Rx Expr.
CLI
REPL
Online playground
VSCode extension
IntelliJ extension
JavaScript bunderBabelVite,
Rollup,
ESBuild,
Webpack
Rust macro
Linter
Formatter

Language integrations

Packages

ToolMelodyPomsky
Homebrew
AUR
Nix
GitHub release binary (Apple)
GitHub release binary (Windows)
GitHub release binary (Linux)
Node module
Python module

IDE features

FeatureMelodyPomsky
Syntax highlighting
Error highlighting
Code folding11
Auto indentation
Snippets
Matching brackets and quotes2
Keyword autocomplete2
Variable autocomplete3
Backreference autocomplete
Character class autocomplete
Unicode property autocomplete
Hover tooltips
Apply suggestions
Share link (playground)

1 indentation based
2 works in playground VSCode, but not in the playground
3 does not take scopes into account


Found a mistake? Please fix it on GitHub.