Regular Expressions

Regular Expressions are one of the most important tools in a programmer’s toolbox.
A regex master can achieve magical string manipulation with a few characters!

If you’ve never heard about regular expressions, now is time. RegexBuddy can help get you started.

Most languages that have a standard library, also have their own implementation of regular expressions. python has re, go has regexp, elixir has :re, rust has regex (which has go bindings too!) etc’.

Those Implementations are not the only ones though, there are numerous regex engines in the wild. I gathered the interesting ones for you in this blog post.

PCRE

The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. PCRE has its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API. The PCRE library is free, even for building proprietary software.

PCRE powers nginx and is used as the regular expression engine for Julia, and Perl of course.

You can grab the C++ library here, and there are bindings for many other languages.

RE2

Google has its own implementation of regex, called RE2.

RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python. It’s used internally by Google and in under constant development.

You can grab the C++ library here. There are bindings for other languages, such as: python, ruby, erlang, nodejs.

Oniguruma

Oniguruma supports a variety of character encodings. It used to be the default regular expression engine for Ruby.

Oniguruma powers popular tools such as: Atom, Sublime Text, and jq.

There are bindings various languages, such as: rust, ruby, nodejs, golang.

Onigmo

Onigmo is a fork of Oniguruma, which includes some features introduced in Perl 5.10+. It is also the default regular expression engine for Ruby since version 2.0.

RE3

re3 tries to re-invent the syntax of regular expressions to make them more readable, and thus easier to learn and maintain.

According to its creator, Aur Saraf: Regular Expressions are one of the best ideas in the programming world. However, Regular Expression syntax is a ^#.\! accident from the 70s. Lets fix it.*

You can grab re3 from here, and watch the “Reasons to Switch to re3” slideshare here.

! re3 is only implemented in python