Skip to content

Commit 01a30a8

Browse files
Remove HTML Tags from a String in a Flow (#1072)
* Create readme.md * Update readme.md * Create extract-json-key.js Adding js * Rename extract-json-key.js to remove-html-tags.js * Create Remove HTML Tags from a String in a Flow
1 parent d1f4857 commit 01a30a8

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This code will be helpful to those who are looking out to remove HTML tags and convert it to String variable within the Flow Designer. The Replace String transformation function doesn't works well with the HTML variable so to overcome this challenge, we can make use of a Run Script Flow action along with a regex and JavaScript replace method.
2+
3+
The function expects the input HTML string to be passed into and we get a string free from HTML tags and whitespaces as an output.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(function execute(inputs, outputs) {
2+
var htmlString = inputs.htmlValue; // Assuming HTML string is stored in the input variable htmlValue
3+
var plainText = htmlString.replace(/<[^>]+>/g,''); // Regex to replace HTML tags
4+
outputs.plainString = plainText.trim(); // Trimming the whitespaces, if any and pushing the string without HTML to output variable plainString
5+
})(inputs, outputs);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)