testx

To check if a text has matches with a given regular expression

This function does the same as contains(): it checks a text for the occurrence of a certain string. But doing this, it uses regular expressions. You, therefore, have much more possibilities to analyze your given texts.

Using regular expressions might need some extra research. We recommend checking regular expressions on https://regex101.com/ (external link).

Syntax

testx(string, string)

testx(string, string, string)

Return

boolean

Examples

testx(myText, regex) To return Yes (true) if a given text matches a given regular expression.

testx("Hello [username]! You have [number of messages] messages!", "\[(\w|\s)*\]")

Result: Yes (true)

(with the regular expression matching any combination of normal characters and white spaces between square brackets)

testx(myText, regex, flags) To return Yes (true) if a given text matches a given regular expression. Flags can be added to the regular expression.

See also

contains, which checks if a given string contains the exact given match

extractx, which extracts a substring from a given string using a regular expression

replacex, which replaces the matches of a given regular expression with a given string in a given text

Last updated