Given the following HTML:
<div class="date">
<span>
<i class="far fa-user"></i> {Name}
<i class="fas fa-link"></i> LINK
<i class="fas fa-sync-alt"></i> {ReblogSource}
</span>
<span>
<!--irrelevant content-->
</span>
</div>
How do I completely remove <i class="far fa-user"></i> {Name}
when {Name}
could be any (number of) plain-text characters? The <span>
it appears in is the first child of .date
(though there are many other instance of <span>
on the page), and the string I want to remove is the first child of that. Based on Christophe's answer, I thought I could try
var string = '/<i class="far fa-user"></i>.+<i class="fas fa-link"></i>/';
replace(string, '<i class="fas fa-link"></i>');
but evidently there's something wrong with that. I'm... rather bad at this language.
+: {ReblogSource}
also becomes an unknown length/content string of plain text. <i>
is FontAwesome. I would rather not have answers involve the second <span>
, especially if it must be involved by exact content.
++: I see both answers work in the snippet, but for some strange reason, Tumblr doesn't want to make it work. I've attached a screenshot of my end of things here, but I have a feeling I'll need to troubleshoot on my own from here.