In this article, we will outline how to use the functions RemoveFrom and RemoveUntil to optimize text using the expression engine.
Use case:
In certain cases, to simplify the process of cleaning the data in a given field you can remove text in bulk, from a given piece of text to the location of another piece of text.
Example 1
Your title:
Digital SLR Camera 12.2 Mpixel - text additional information/1425XWYZ
The desired outcome:
Digital SLR Camera 12.2 Mpixel - text
Here is how it works:
Example 2
Your title:
Digital SLR Camera 12.2 Mpixel - text additional information/1425XWYZ
The desired outcome:
Digital SLR Camera 12.2 Mpixel
Here is how it works:
The command you write: RemoveFrom(field1,"text") and if you wish to include the text RemoveFrom(field1,"text",true)
Example 3
In case the text you wish to remove is located in front of your chosen field, the logic is exactly the same as in Example 1 and Example 2.
Your title:
text additional information/1425XWYZ - Desktop PC with CDRW
The desired outcome:
Desktop PC with CDRW
Here is how it works:
The command you write: RemoveUntil(field1,"text") and if you wish to include the text RemoveUntil(field1,"text",true)
You can combine the function RemoveUntil/RemoveFrom with other functions to optimize your data.