String blocks are handled at the text level. The result of a string block will be a string.
REGEX
The REGEX block accepts a regular expression to search the content. For example:
{{REGEX[match=1]:/Phone: (\d{8})/mi}}
This will extract a phone number from the content.
The regular expression must have /
to mark the start and end of the expression. The modifier can be specified after the end /
.
Settings
match: Default is 0. This specifies the matched group to be returned from the regular expression. The default is to return the whole matched string.
For example, given that the source document is:
The result of {{REGEX:/<img[^>]+src="([^">]+)"[^>]+alt="([^>"]+)"[^>]+>/}}
is:
The result of {{REGEX[match=1]:/<img[^>]+src="([^">]+)"[^>]+alt="([^>"]+)"[^>]+>/}}
is:
logo.png
The result of {{REGEX[match=2]:/<img[^>]+src="([^">]+)"[^>]+alt="([^>"]+)"[^>]+>/}}
is:
Logo image
Read More
As this documentation is not explaining the regular expression itself, here are some websites to help you get started with regular expression:
LITERAL
The LITERAL block will simply return the text specified in the block. This is usually used to add static text in the rule expressions. For example:
{{LITERAL:Hello World}}
This will return string “Hello World”.