Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

REGEXEXTRACT

Dan Gorman edited this page Nov 29, 2018 · 2 revisions

The REGEXEXTRACT Function

Function Group: Text

REGEXEXTRACT finds the first appearance of a string within a block of text.

Syntax

REGEXEXTRACT(arg1, arg2)

  • arg1 is a string to be searched
  • arg2 is the regex pattern to be searched for

Uses

Let's say we're given a response with some vehicle information that looks like this:

{  
   "data":{  
      "mechanic_reports":{  
         "vehicle_1":{  
            "description":"The car was still functional, but had a bad radiator, and was in bad condition."
         }
      }
   }
}

If we know that the description attribute is going to have a standard form and used standardized terminology, we can do a search for, let's say, "functional":

REGEXEXTRACT(data.mechanic_reports.vehicle_1.description, ".unctional")

This would return functional, because it was found in the string. In the event that regex isn't matched, REGEXEXTRACT returns null.

Clone this wiki locally