SRL - Simple Regex Language
Regular Expressions Made Simple

Quantifiers

Quantifiers are probably one of the most important things here. If you've specified a character or a group in your query and now want to multiply it, you don't have to copy and paste all of it. Just tell them.

Oh, and don't be confused. Sometimes, you may find that these quantifiers don't match with the tinkered example. That's okay, since we're not forcing the string to start or end. Thus, even if only parts of that string are matching, the expression will be valid.

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

exactly x times

exactly x times

You're sure. You don't guess, you dictate. exactly 4 times. Not more, not less. The statement before has to match exactly x times.

Note: since exactly x times is pretty much to write, short terms exist. Instead of exactly 1 time, you can write once, and for 2, take twice

Example query:

digit exactly 3 times, letter twice

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:


        

between x and y times

between x and y times

For a specific number of repetitions between a span of x to y, you may use this quantifier. It will make sure the previous character exists between x and y times.

Note: since between x and y times is pretty much to write, you can get rid of the times: between 1 and 5

Example query:

starts with digit between 3 and 5 times, letter twice

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:


        

optional

optional

You can't always be sure that something exists. Sometimes it's okay if something is missing. In that case, the optional quantifier comes in handy. It will match, if it's there, and ignore it, if it's missing.

Example query:

digit optional, letter twice

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:


        

once/never or more

once/never or more

If something has to exist at least once, or never, but if it does, then it may exist multiple times, the quantifiers once or more and never or more will do the job.

Example query:

starts with letter 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:


        

at least x times

at least x times

Something may exist in an infinite length, but must exist at least x times.

Example query:

letter at least 10 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: