Add stripHTMLTags
This commit is contained in:
13
snippets/stripHTMLtags.md
Normal file
13
snippets/stripHTMLtags.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
### stripHTMLTags
|
||||||
|
|
||||||
|
Removes HTML/XML tags from string.
|
||||||
|
|
||||||
|
Use a regular expression to remove HTML/XML tags from a string.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const stripHTMLTags = str => str.replace(/<[^>]*>/g, '');
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
stripHTMLTags('<p><em>lorem</em> <strong>ipsum</strong></p>'); // 'lorem ipsum'
|
||||||
|
```
|
||||||
@ -213,6 +213,7 @@ sortedLastIndexBy:array,math,function
|
|||||||
splitLines:string
|
splitLines:string
|
||||||
spreadOver:adapter
|
spreadOver:adapter
|
||||||
standardDeviation:math,array
|
standardDeviation:math,array
|
||||||
|
stripHTMLtags:string,utility,regexp
|
||||||
sum:math,array
|
sum:math,array
|
||||||
sumBy:math,array,function
|
sumBy:math,array,function
|
||||||
sumPower:math
|
sumPower:math
|
||||||
|
|||||||
Reference in New Issue
Block a user