Text substring tests
This block compares string in the given variable. Left part defines the variable to compare. This argument is required.
In the middle part, three types of comparison modes are available:
- begin with: Content of the variable begins with text.
- ends with: Content of the variable ends with text.
- contains: Content of the variable contains text.
Right side defines string for comparison. This argument is required.
Result of the block is boolean value “true” or “false”.
In case any of the required string arguments is not string, it returns None.
XML representation of the text_test_substring block
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="text_test_substring">
<field name="TYPE">BEGINSWITH</field>
<value name="VALUE">
<block type="variables_get">
<field name="VAR">text</field>
</block>
</value>
<value name="FIND">
<block type="text">
<field name="TEXT">value</field>
</block>
</value>
</block>
<block type="text_test_substring">
<field name="TYPE">ENDSWITH</field>
<value name="VALUE">
<block type="variables_get">
<field name="VAR">text</field>
</block>
</value>
<value name="FIND">
<block type="text">
<field name="TEXT">value</field>
</block>
</value>
</block>
<block type="text_test_substring">
<field name="TYPE">CONTAINS</field>
<value name="VALUE">
<block type="variables_get">
<field name="VAR">text</field>
</block>
</value>
<value name="FIND">
<block type="text">
<field name="TEXT">value</field>
</block>
</value>
</block>
</xml>

Block “Text substring test”

Example of “Text substring test” block
Block is used on the “if text message” row in the example:
- If key “raw” in variable “message” starts with text “Login”, then the block returns boolean value “true”.
Login permitted from 192.168.10.1/1234 to inside:192.168.1.1/https for user admin

Results of “Text substring test” block