Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
Remove the tag from link

display

console log

I want to remove the tag(e.g. <p> <h1>) and leave only link

At first, I thought of cutting by detecting the tag <p>, but I think there will be a non-tag <p> case I don't know how to do that.

sorry for my English skill.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use a regular expression to identify HTML tags in the input string. Replacing the identified HTML tag with null. This will result remove any queries with <> and </> and anything inside of the < > tags.

Here's an example of this below:

function removeTags(str) {
    if ((str===null) || (str==='')) return false;
    else str = str.toString();
    return str.replace( /(<([^>]+)>)/ig, '');
}
removeTags('<p>youtu.be/TJR10xK</p>');

Then log the input with console.log(removeTags('<p>youtu.be/TJR10xK</p>')), what ever you want to do afterwards.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda