let me explain my problem, i have this code so far:
post.contentHtml().replace(/<\/?[^>]+(>|$)/g, '📷')
that strip ALL html tag from the output and replace with '📷'.
Now the problem is that a post can contain multiple tag, so if someone post an image or embed like:
<p><iframe data-s9e-mediaembed="twitter" allow="au…t:250px;max-width:550px;width:100%"></iframe></p>
the result is this: 📷📷📷📷📷
what i'm want to achieve is to show only ONE icon per element, or simply 1 icon. Is that possible
post.contentHtml output is:
ContentHtml: '<p><iframe data-s9e-mediaembed="twitter" allow="au…t:250px;max-width:550px;width:100%"></iframe></p>'
Quantify the regular expression so it will match multiple times in a row.
post.contentHtml().replace(/(<\/?[^>]+(>|$))+/g, '📷')
pattern+ matches a sequence of 1 or more matches of pattern