-
Notifications
You must be signed in to change notification settings - Fork 3
Tokens
Filip Halas edited this page Apr 3, 2014
·
8 revisions
Gomatch uses tokens as a semantic reference to regular expressions. Gomatch comes with some predefined in ./Tokens file, location of this file can be changed via the flag -t
.
The contents of file with Tokens can be:
- Token = name + space + regex. Example:
USERNAME ^[a-zA-Z0-9_-]+$
. - One token per line.
- Single line comments starting with
#
or empty lines.
To reference USERNAME
(declared above) when writing pattern/event use <USERNAME>
or <USERNAME:semantic_name>
.
For more see How to write patterns.
The syntax of the regular expressions accepted is the same general syntax used by Perl, Python, and other languages. More precisely, it is the syntax accepted by RE2 and described at http://code.google.com/p/re2/wiki/Syntax, except for \C.