Syntax: #REGEX id {pattern} {commands} classname options
Related: #TRIGGER, %regex

Creates a PERL Regular Expression trigger. The pattern field is the regular expression. It is expanded for @var variable references. The following regular expression patterns are supported:

. match any single character
* match zero or more of the previous pattern
+ match one or more of the previous pattern
? match zero or one of the previous pattern

(exp) group the regular expression "exp" into a single pattern. The matching pattern is stored in the %1..%99 variables.
(?:exp) group the regular expression as above, but do NOT store the value in the %1..%99 variables.

exp1 | exp2 match expression exp1 OR expression exp2. Any number of expressions can be listed, separated by |

[abc] match a range of letters. In this case, the letters a, b, or c are matched. You can specify a range of characters using the - operator. For example [a-z] matches any lowercase character. Putting ^ before the range defines a range of characters that are excluded. For example [^a-z] matches anything *except* a lowercase character.

^ matches the beginning of line
$ matches the end of the line

\ escapes the next character, matching that character verbatim. For example \* matches an asterisk. \ matches a slash itself. Note that to prevent TeSSH variable parsing the @ character must still be escaped with the normal TeSSH escape character (default of ~) rather than the \ character.

\s a space character (ascii 32)
\p the | pipe character
\w a word delimiter (matches a-zA-Z0-9)
\a a letter (matches a-zA-Z)
\d a digit (matches 0-9)
\h a hex character (0-9A-F)
\n matched a newline for multiline triggers

Like normal TeSSH triggers, a subpattern can be enclosed in parenthesis to save it's matching pattern to the %1..%99 variables. To match a group of patterns without saving it to %nn, use the (?:exp) syntax. To save a subpattern to a named TeSSH variable (like the &Varname syntax for normal triggers), use the (?Varname:exp) syntax.

Regular expression support is provided by the PCRE library package, which is open source software, written by Philip Hazel, and copyright
by the University of Cambridge, England. #CW high,red}

Matches one or more 'a' characters and colors them red.

#REGEX {(Zugg|Darker)} {#CW high,red}

Matches any line that contains the word "Zugg" or the word "Darker" and colors the word in red.

Add comment

Login or register to post comments