Answers as Regular Expressions

CHUI supports creating Challenges where the Answer must be exactly typed by the Player, or if the Player matches a pattern defined by a Regular Expression (regex). Whether the Answer must be exact or must match a pattern is up to the Event Author when a Challenge is created.

If you are unfamiliar with how Regular Expressions work, spend some time online reading about their structure and application. Consider using this external resource for assistance in building your Regular Expressions and validating that your regex will correctly match the patterns you intend to be acceptable Answers.

The Event Builder Tool will not Add or Edit an Answer if the Regular Expression is invalid (contains formatting errors)!


Switch tabs to Challenges (or click the arrows > or < along the top).

Then scroll down in the Data Editor to the Answer field.


Leave the box unchecked to have the Answer field processed as an exact match only.

Check the box to have the Answer field processed as a Regular Expression allowing Players to match the pattern.

Note: Brackets [ ] allow the Event Author to specify a set of acceptable characters for that position in the Answer. This regex Answer will match either january or January as acceptable Answers.


Another common regex example is to be flexible with plural words.

The Question Mark specifies to match 0 or 1 of the preceding characters in the regex. In this example, either hedgehog or hedgehogs triggers a match.


Notice the use of the caret symbol ^ in Regular Expressions. This indicates that the match must begin at the start of an Answer. If you do not use the caret ^ symbol, then the match can occur anywhere in the Answer. Is that what you want?

hedgehogs? would match hedgehogs or 123hedgehog or cyber_hedgehogs etc.

Also notice the use of the dollar sign $ in Regular Expressions. This indicates that the match must occur at the end of the Answer. So again, the following would be an acceptable match if you don’t leverage dollar signs $ at the end of your regex:

abc123hedgehogs456


There are a number of characters that have special meaning in Regular Expressions. If you need one of these characters to be in your answer, you must escape the special meaning by typing a backslash \ first:

Some special characters: \ * + ? | { [ ( ) ^ $ . #

^cyber\.hedgehogs?$ creates a match for cyber.hedgehogs or cyber.hedgehog