Is it possible to add a target="_blank" to all <a> tags, with just one regular expression? I've been experimenting with negative and positive look aheads/behinds, to no avail. This should:
- Match anchor tags whose
hrefstarts withhttp:// - If the anchor tag does not have a
targettag, adds atarget="_blank"tag - If it does have a
targettag, it checks if thetargettag is not already set to"_blank", and if not it is replaced totarget="_blank"
Is this possible? If not, what would be the least computationally intensive way to do this?