SRL - Simple Regex Language
Regular Expressions Made Simple

Let's Get Started

Welcome to the great world of SRL! SRL, or Simple Regex Language, is an easy to use language to form and build Regular Expressions. You no more have to struggle with odd characters and signs and worry if you've forgotten a +, . or \ somewhere. SRL is simple but powerful and helps you to prevent common mistakes. And in addition to that it saves you a lot of time since you don't have to learn how to write Regular Expressions any more.

But before we get started, a short note on what this project is not: SRL is not trying to replace Regular Expression. It is mainly thought for beginners and people who just have to write one or two regular expressions per year. It doesn't make sense for them to practise that complicated syntax.

There are a few basic syntax rules you should know before diving into it:

Using SRL Through the Website

Feel free to use SRL through the website to create your Regular Expressions. You're able to enter the Query on the following page and then receive the resulting Regular Expression which can be used in any language. This is definitely the simplest way of using SRL. But don't forget to supply the corresponding SRL in a comment next to where you're using the Regular Expression, since you then will be able to easily debug and understand it even a few days or weeks later.

Build Your SRL Query Online

Using SRL as a Project Dependency

A much cooler way than building the SRL Query online and then copying the Regular Expression is directly using SRL in the code. Currently, this is possible when using PHP 7, JavaScript, Python or Ruby. By the way, if you'd like to help extend this list, please check our Contribution Guide.

Below you can find a list of all official SRL implementations. Just pick your favorite language:

SRL for PHP SRL for JavaScript SRL for Python SRL for Ruby

Using SRL as a Command Line Tool

If you prefer to use a command line tool to convert your SRL query into a regular expression, you can use srl2ruby.

To get started, run gem install srl_ruby to install the tool. Once that's done, go ahead and execute it by invoking srl2ruby, where is just a text file containing your SRL query. It will then output the converted regular expression to STDOUT.