STRING.matches

Tests if the string matches a regular expression.

Syntax

matches(
     regex STRING )
   RETURNS BOOLEAN
  1. regex is the regular expression. See Regular expression patterns.

Usage

This method scans the current string and returns TRUE, when the string matches the regular expression passed as parameter.

Note: When using single or double quoted string literals, backslash is interpreted as escape character. Consider using back quotes as delimiters for regular expressions strings, and use backslash characters directly as required by the regexp syntax ( `\b` instead of "\\b" or '\\b' )

Example

MAIN
    DEFINE s STRING
    LET s = "id_243"
    DISPLAY s.matches(`^[[:alpha:]_]+[[:alnum:]_]*$`)
END MAIN
Output:
     1