regex
This content is for v1.0. Switch to the latest version for up-to-date documentation.
The regex namespace provides full ECMAScript-compatible regular expression capabilities.
regex.test
Section titled “regex.test”Check if a string matches a pattern.
regex.test(str, pattern) -> boolprint(valid);regex.match
Section titled “regex.match”Find all matches of a pattern in a string.
regex.match(str, pattern) -> arrayvar numbers = regex.match("Order #42 cost $99 with item #105", "\\d+");print(numbers);regex.replace
Section titled “regex.replace”Replace occurrences matching a pattern.
regex.replace(str, pattern, replacement) -> stringvar sanitized = regex.replace("user_123_temp", "_temp$", "");print(sanitized);regex.split
Section titled “regex.split”Split a string by a regular expression delimiter.
regex.split(str, pattern) -> arrayvar parts = regex.split("apple, banana; orange : grape", "[,;: ]+");print(parts);