Callisto Knowledge Base

This page is optimized for desktop computers and tablets. To access it, try one of the following points:

  • Access this page from a different device.
  • If you’re on a tablet, rotate it.
  • Check the “Desktop site” option in your browser settings.
Return to CTModule homepage
Knowledge Base

Regular expressions

CTMaker, SQLite as well as some functions in Callisto support regular expressions. The following basic regex syntax is available:

Character Legend
^ Match the beginning of a buffer.
$ Match the end of a buffer.
() Group characters or capture them as substring.
\s Match whitespace.
\S Match non-whitespace.
\d Match decimal digit.
\n Match new line character.
\r Match line feed character.
\f Match form feed character.
\v Match vertical tab character.
\t Match horizontal tab character.
\b Match backspace character.
+ Match one or more characters (greedy; match as many as possible).
+? Match one or more characters (lazy; match as many as needed).
* Match zero or more characters (greedy; match as many as possible).
*? Match zero or more characters (lazy; match as many as needed).
? Match zero or one character (lazy).
x|y Match either x or y (alternation operator).
\meta Literally match one of the meta characters: ^$().[]*+?|\
Example: \? matches a question mark.
\xHH Match a character by its hexadecimal value.
Example: \x4a matches the letter J.
[…] Match any character from a given set. Ranges like [a-z] are supported.
[^…] Match any character except the ones from the set.

The following functions evoke a search by regular expressions. They return the matching string, or an empty string if there is no match.

  • SQLite: regexp(pattern, data)
  • CTMaker: STR_Regex(pattern, data)