Regular Expressions in Functions

In Studio, you use regular expressions by calling functions (methods) used on string objects. The following string functions support regular expressions:

Function Purpose Returns
contains() Matches a substring contained in the string. Bool
isMatch() Matches the string completely. Bool
indexOf() Gets the first index location where the regular expression matches the string. Int
lastIndexOf() Gets the last index where the regular expression matches the string. Int
match() Attempts to match and return the substring(s) that matched the regular expression. This is useful for extraction and parsing. String[] - The array of subexpressions (groupings) matched. When the g modifier is used, the array of matched occurrences is returned instead.
split() Splits a string using the given regular expression as a separator. String[] - The array of fields (pieces of the string that were separated by the given separator.)
count() Gets the number of substrings (within the string) that the given regular expression matches. Int
replace() Replaces pieces of the string with new strings. String - the new modified string.