SRL - Simple Regex Language
Regular Expressions Made Simple

Characters

Characters are everything that matches the string directly. They are the groundwork to which quantifiers will apply. The syntax always looks as follows:

character [specification] [quantifier] [others]

As you can see, characters always come first. They start a new statement, and everything that follows defines the previous character. Some characters allow a specification: letter, for example, allows you to define a span of allowed letters: from a to f

Every character or character set can be quantified. You may want to match exactly four letters from a to f. This would match abcd, but not abcg. You can do that by supplying exactly 4 times as a quantifier:

SRL Syntax:

letter from a to f exactly 4 times

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

And remember: You can execute every query by clicking it, and then pressing the button!

Okay, let's dive into the different characters. Below, you can find a list of all available characters along with an example query.

literally

literally "string"

The literally character allows you to pass a string to the query that will be interpreted as exactly what you've requested. Nothing else will match, besides your string. Any special character will automatically be escaped. The sample code matches, since the test string contains "sample". Try removing it.

Example query:

literally "sample"

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

one of

one of "characters"

literally comes in handy if the string is known. But if there is a unknown string which may only contain certain characters, using one of makes much more sense. This will match one of the supplied characters.

Example query:

one of "a%1"

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

letter

letter [from a to z]

This will help you to match a letter between a specific span, if the exact word isn't known. If you know you're expecting an letter, then go for it. If not supplying anything, a normal letter between a and z will be matched. Of course, you can define a span, using the from x to y syntax.

Please note, that this will only match one letter. If you expect more than one letter, use a quantifier.

Example query:

letter from a to f

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

uppercase letter

uppercase letter [from A to Z]

This of course behaves just like the normal letter, with the only difference, that uppercase letter only matches letters that are written in uppercase. Of course, if the case insensitive flag is applied to the query, these two act completely the same.

Example query:

uppercase letter from A to F

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

any character

any character

Just like a letter, any character matches anything between A to Z, 0 to 9 and _, case insensitive. This way you can validate if someone for example entered a valid username.

Example query:

starts with any character once or more, must end

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

no character

no character

The inverse to the any character-character is no character. This will match everything except a to z, A to Z, 0 to 9 and _.

Example query:

starts with no character once or more, must end

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

digit

digit [from 0 to 9]

When expecting a digit, but not a specific one, this comes in handy. Each digit matches only one digit, meaning you can only match digit from 0 to 9, but multiple times using a quantifier. Obviously, limiting the digit isn't a problem either. So if you're searching for a number from 5 to 7, go for it!

Note: number is an alias for digit.

Example query:

starts with digit from 5 to 7 exactly 2 times, must end

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

anything

anything

Any character whatsoever. Well.. except for line breaks. This will match any character, except new lines. And, of course, only once. So don't forget to apply a quantifier, if necessary.

Example query:

anything

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

new line

new line

Match a new line. Forgive us, if we can't provide an example for that one, but you can check it out on the builder.

[no] whitespace

[no] whitespace

This matches any whitespace character. This includes a space, tab or new line. If using no whitespace everything except a whitespace character will match.

Example query:

whitespace

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

tab

tab

If you want to match tabs, but no other whitespace characters, this might be for you. It will only match the tab character, and nothing else.

Example query:

tab

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

backslash

backslash

Matching a backslash with literally would work, but requires escaping, since the backslash is the escaping character. Thus, you'd have to use literally "\\" to match one backslash. Or you could just write backslash.

Example query:

backslash

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression:


        

raw

raw "expression"

Sometimes, you may want to enforce a specific part of a regular expression. You can do this by using raw. This will append the given string without escaping it.

Example query:

literally "an", whitespace, raw "[a-zA-Z]"

Test Input

Run Query!

SRL Query is matching!

SRL Query is not matching.

The SRL Query contains an error:

Whoops... you may have found a bug.

Generated Regular Expression: