Last active
July 22, 2024 19:12
-
-
Save HubSpotHanevold/2c341624ba9ba17d446146581c12a21c to your computer and use it in GitHub Desktop.
Convert html in rich text to friendly text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.main = async (event, callback) => { | |
| let originalString = 'TEXTGOESHERE'; | |
| let updatedString = originalString.replace(/<br>/g, ';') | |
| let nextupdatedString = updatedString.replace(/<(?=\s*[^a-zA-Z\/])/g, '****'); | |
| let nextnextupdatedString = nextupdatedString.replace(/<[^>]*>|#nextsteps| /g, '') | |
| let finalString = nextnextupdatedString.replace(/\*\*\*\*/g, '<'); | |
| callback({ | |
| outputFields: { | |
| finalString: finalString | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment