I’ve got a string and I’m trying to replace all   within tags with empty spaces.
All   outside of the tag should however not be replaced, what i would basically need to do is check whether the   string has “< a” (without the space) in front of it. For example if I had the string:
 <a href="#"></a>
Then this should be turned into:
 <a href="#"></a>
Is there a way to check whether the   string has “< a” before it and if it does replace it?
I’ve had a look at the javascript replace function and i know how to replace all   strings, but not only ones with a specific string infront..
Hope that makes sense and let me know if you have any ideas, thanks 🙂
If you have control over what the string will be, you should consider including the semicolon for the reason Kolink described.
Either way, this will do the trick (and in this example, I include semicolons):
This looks for the phrase
<a in the string and replaces it with<a.