RegEx text find and replace
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello experts. I am struggling with my attempts to find either the correct formula or RegEx expression which will remove certain HTML tagging from a specific column in my dataset.
I have the following tags which I am trying to remove:
- <p style="position: static;">
- </p>
- <span style="color: rgb(34, 34, 34); font-family: Poppins; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important; position: static;">
- </span>
The raw text appears as
- <p style="position: static;">TextTextText TextTextText.</p>
- <span style="color: rgb(34, 34, 34); font-family: Poppins; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important; position: static;">TextTextText Text Text Text</span>
I have attempted to utilize the following Formula with no success (undesired text remains):
- REGEX_REPLACE([Rule Name], "<pstyle=['\"]?[^'>'\"]*['\"]?>", "")
I have attempted to utilize the RegEx expression and a few others with no success (undesired text remains)
(<p style="position: static;">\s)
I appreciate any help the experts can provide!
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Are there tags you need to keep? If you need to remove all HTML tags you can use this as your regex.
REGEX_REPLACE([Rule Name],<[^>]+>,"")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you for the suggestion. No, I do not want to keep any part of the tag - I wish to remove it entirely.
I utilized the formula and received an error - "Parse Error at char(25): Malformed Function Call (Expression #1).
- Character 25 in the formula is ' ] ' which comes after the output column name, 'Rule Name'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I just figured out the issue with the formula. The text that I want to replace was not surrounded by quotation marks. The correct syntax for the formula is:
REGEX_REPLACE([Rule Name],"<[^>]+>","")
