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
RE2

*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 by JavaScript engines. Also Boost.Regex can be configured to use the ECMAScript syntax.

  • PCRE (an acronym for “Perl compatible regular expression”) is the syntax used by the PCRE(2) regex engine, which is arguably the most popular regex engine in the world. It is used by default in PHP and R, and can be embedded in many other languages. It can also be used by 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, which is used by ripgrep, for example.

  • RE2 refers to Google’s RE2 regex engine. Go’s "regexp" module uses the same syntax.

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
Dotpartly*
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

*Pomsky deliberately does not support the dot. You can use instead:

  • C to match all code points
  • ![n] to match all code points except line breaks

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

Note that Melody allows embedding a regex by wrapping it in backticks, so technically everything is supported. For example:

either {
  'Foo';
  `[^Bar;]`;
}

Advanced features

FeatureMelodyPomskyEgg Expr.Rx Expr.
Variable
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

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

Tooling

ToolMelodyPomskyEgg Expr.Rx Expr.
CLI
REPL
Online playground
VS Code extension
IntelliJ extension
Babel plugin
Rust macro
Linter
Formatter

Packages

ToolMelodyPomsky
Brew package
AUR package
Nix flake
GitHub release binary for Apple
GitHub release binary for Windows
GitHub release binary for Linux
Node module
Python module

IDE features

FeatureMelody (VS Code)Melody (playground)Pomsky (playground)
Syntax highlighting
Error highlighting
Code folding
Auto indentation
Matching brackets and quotes
Keyword autocomplete
Variable autocomplete
Character class autocomplete
Unicode property autocomplete
Hover tooltips
Apply suggestions
Share link

Found a mistake? Please fix it on GitHub.