Regular expression tips

Posted by Kyle Hankinson August 17th, 2022


General

If you need a trigger or alias to match on a regular expression, here are some hints and tips to use.

Regex vailidation

As you type your regex, the main mud display will update to highlight matches.

The trigger editor highlighting regular expression matches in the game output
  • The background will be highlighted with the full match range. The full match can be accessed in script via textOf(0).
  • Each capture group will be underlined and can be used as a paramter in the script via textOf(1), textOf(2), textOf(3), etc.

Whitespace

For whitespace (space, tab, linebreak) use the \s+ syntax option. While most muds will use spaces, some muds will use tabs is certain instances which may case a basic space match to fail.


Tags: Scripting