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:
SRL is case insensitive. Thus,
LITERALLY "test"is exactly the same as
literally "test". But please beware, that everything inside a string is in fact case sensitive.
LITERALLY "TEST"does NOT equal
- The comma separating statements is completely optional and has no effect whatsoever. In fact, it gets removed before interpreting. But since it helps the human eye to distinct between different statements, it's allowed.
- Strings are interpreted as literal characters and will be escaped. They can either be defined using 'single' or "double" quotation marks. Escaping them using a backslash is possible as well.
- Parentheses should only be used when building a sub-query, for example while using a capture or non-capture group to, for example, apply a quantifier to multiple items.
- Comments are currently not supported and may be implemented in the future.
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
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 filename.srl, where
filename.srl is just a text
file containing your SRL query. It will then output the converted regular expression to STDOUT.