This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
REGEXREPLACE
Dan Gorman edited this page Nov 29, 2018
·
2 revisions
REGEXREPLACE
finds appearances of a regex within a block of text and replaces it.
REGEXREPLACE(arg1, arg2, arg3)
-
arg1
is a string to be searched -
arg2
is the regex pattern to be searched for - any instance matched will be replaced witharg3
-
arg3
is a string that will replace any found instances ofarg2
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 bad axels, and was in bad condition."
}
}
}
}
If we know that the description
attribute is going to have a standard structure and used standardized terminology, we can do a search and replace for, let's say, "bad":
REGEXREPLACE("The car was still functional, but had a bad axels, and was in bad condition.", "ba.", "imperfect")
"The car was still functional, but had imperfect axels, and was in imperfect condition."