Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!