Xbasic

REGEX_VALID Function

Syntax

is_valid as L = regex_valid(C text )

Arguments

textCharacter

A character string containing the regular expression to validate.

Description

Validates a regular expression.

Discussion

The REGEX_VALID() function tests a regular expression to determine whether or not the regular expression is valid.

Example

? regex_valid("[.+")
= .F.
 
'The issue with the above failing regular expression is lack of a closing ']'.

? regex_valid("[.+]")
= .T.

? regex_match(".","[.+")
ERROR: Unmatched [ or [^ in character class declaration. The error occurred while parsing the regular expression: '[.+>>>HERE>>>'.

See Also