Templating reference
Prefixes
These are all the permitted prefix notations:
Prefix |
Description |
|---|---|
m |
Match one line. |
m* |
Match zero or more lines. |
m+ |
Match one or more lines |
m? |
Match zero or one lines. |
m{n} |
Match N lines. |
m{n,m} |
Match N to M lines. |
r |
Regex match one line. |
r* |
Regex match zero or more lines. |
r+ |
Regex match one or more lines |
r? |
Regex match zero or one lines. |
r{n} |
Regex match N lines. |
r{n,m} |
Regex match N to M lines. |
Any of these may be postfixed with (variable_name) to stash a list
as a key in a dictionary instead, for example if m resulted in a list
['foo', 'bar'] then m(wibble) would change this to
{'wibble': ['foo', 'bar']}.
Additionally flags may be prefixed with a slash. The only flag supported is
lax which allows garbage before and after the match criteria. So
m> ble or m/!lax> ble would only match "ble", but
m/lax> ble could match "wibble" or :code:”ibbles”` as well.
Core matches
These are the built in matches:
Name |
Type |
Description |
|---|---|---|
integer |
int |
An integer. |
non_ws |
str |
Non white space. |
word |
str |
A word (in regular expression terms). |
ws |
str |
White space |
string |
str |
Any amount of text. |
hostname |
str |
An internet fqdn (hostname). |
ipaddr |
str |
An (IP) internet address. |
number |
float |
An integer or floating point number. |
common_dt |
str |
A date time. |
See custom matches if you want to add your own.
Core function matches
These are the built in match functions:
Name(parameters) |
Type | Description |
|
|---|---|---|
re(regex) |
str |
A raw regular expression. |
fixedwidth(width, strip) |
str |
A fixed width column. Strip (default true) turns white space strip on/off. |
See match functions if you want to add your own.
Functions
These are the built in (post processing, non match) functions:
Name(parameters) |
Type | Description |
|
|---|---|---|
rstrip() |
str |
Strip right hand side white space. |
lstrip() |
str |
Strip left hand side white space. |