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.
>Solution :
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.

