Looker Studio calculated field – Remove HTML tags from a text field
September 18, 2024
- by Mehdi Oudjida
The Looker Studio calculated field below cleans a text field removing any HTML tag.
- Explanations of the formula
- Any HTML tag starts with “<” and ends with “>”
- We create a regular expression (regex) corresponding to this substring
- And we take advantage of REGEXP_REPLACE function to replace all the matching occurrences of this substring with an empty string
- Input
- Any text dimension
- Output
- A text-typed dimension without HTML tag
- Used functions
Text dimension without HTML tag
REGEXP_REPLACE(My text field, '(<[^>]+>)','')