Skip to main content

TRY_PARSE

Deprecated version

This document refers to a deprecated version of the RQL programming language.

Please go here for documentation related to the latest supported version.

Parses a string with a regular expression. Returns either a single element or a record of strings with the number of groups in the regular expression. If the regular expression fails to match, returns null.

Syntax
TRY_PARSE(<string>, <regex>)
Example
TRY_PARSE("ab cd", r"""(\w+).*""") // "ab"
TRY_PARSE("ab cd", r"""(\w+)\s+(\w+).*""") // ("ab", "cd"), equivalent to (_1: "ab", _2: "cd")