Regular Expressions

Regular expressions offer a powerful text matching syntax, which you can use to make decisions in your commands and triggers. If you're already familiar with PCREs, this cheat sheet lists all the special symbols that have meaning in a regexp.

Result:

Regexp Features

Normal text in a regular expression matches that exact text. In these examples, [Hh]ello is a regexp, and hello is text that matches it.

A regexp conditional succeeds if any part of the string matches it. The condition [Hh]ello would match on the input "Why, hello there!", and would set {regexp0} to hello.

Anchors

A regexp will match anywhere in the text, unless it is anchored with a ^ at the start and/or a $ at the end. You can also match entire words (including emote names) by anchoring with \b.

Sets of characters

To match any of a group of characters, use square brackets.

For alternatives that are more than one character long, use either-or notation:

Matching multiple of something

To match more than one of the same group of characters, add a marker after the group.


Test out your regular expressions above and then use them in conditionals in commands and triggers.