Created
December 27, 2018 16:03
-
-
Save caio-ribeiro-pereira/2baad7e01c00f0c454309e128318a78c to your computer and use it in GitHub Desktop.
Extraindo conteúdo de string tags html
This file contains 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
const conteudo = '<h1>JavaScript</h1> <h2>é o melhor!</h2>'; | |
const texto = conteudo.replace(/<[a-zA-Z/][^>]*>/g, ''); | |
console.log(texto); // "JavaScript é o melhor!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment