REGEXP() is a powerful text-matching function that can be used in three different ways:
Match and return a portion of a string that matches a regular expression
Return a sub-portion of a string matching a regular expression, referencing parenthesized groups
Return a new string with replacements for parts matching a regular expression
Function Format
REGEXP(string, match string [, string | number])
Return Value
REGEXP() returns a character string
Examples
// Basic pattern matching
REGEXP('2.71828 IS LESS THAN 3.14159', '[0-9.]+') = '2.71828'
// Using capture groups
REGEXP('2.71828 IS LESS THAN 3.14159', '([0-9.]+)([^0-9.]+)([0-9.]+)', 1) = '2.71828'
REGEXP('2.71828 IS LESS THAN 3.14159', '([0-9.]+)([^0-9.]+)([0-9.]+)', 3) = '3.14159'
// Pattern replacement
REGEXP('2.71828 IS LESS THAN 3.14159', '([0-9.]+)([^0-9.]+)([0-9.]+)', '$3 IS CALLED ''PI''') = '3.14159 IS CALLED ''PI'''