Skip to content

Instantly share code, notes, and snippets.

@caio-ribeiro-pereira
Created December 27, 2018 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caio-ribeiro-pereira/2baad7e01c00f0c454309e128318a78c to your computer and use it in GitHub Desktop.
Save caio-ribeiro-pereira/2baad7e01c00f0c454309e128318a78c to your computer and use it in GitHub Desktop.
Extraindo conteúdo de string tags html
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