Regexp()

Home   Back   Next  

Working with Formulas > Functions Used in Formulas > Text Functions > Regexp()

 

REGEXP() is a powerful text-matching function that can be used three ways.

 

1.It can be used to match and return a portion of a string that matches a regular expression specified in the second parameter of the function.
2.It can be used to return a sub-portion of a string matching a regular expression, referencing the part of the regular expression enclosed in parentheses with a third, numeric parameter.
3.It can be used to return a new string that replaces parts of the original string matching a regular expression with new values, specified by a third, string parameter.

 

 

Function Format

 

REGEXP(string, match string [, string | number]) 

 

 

Return Value

 

REGEXP() returns a character string 

 

 

Examples

 

REGEXP("2.71828 IS LESS THAN 3.14159", "[0-9.]+") = "2.71828" 

 

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" 

 

REGEXP("2.71828 IS LESS THAN 3.14159", "([0-9.]+)([^0-9.]+)([0-9.]+)", "$3 IS CALLED 'PI'") = "3.14159 IS CALLED 'PI'"