Forum Moderators: open
temp = "<b>hi there,<a href='www.example.com'>i'm a link</a>";
I would like that to turn into
"hi there, www.example.com i'm a link"
I've been googling for quite a while and I can't seem to find any solution.
I'd guess I'd need to search temp for href, grab the next item that's in quotes, spit it out next to it, then do the regexp.
I'm just not sure how to do that exactally.
Can I treat the string as an array of characters? I could go through one at a time, find href, use recursion, go backwards, spit the link out right before the '<a' and continue forward skipping the next href. Even if I can do that, I'm not sure how to insert the item in the string.
I'd also perhaps want to do the same thing with src in imgs.
[EDIT]
I was thinking after I originally posted this (in wrong forum)
If I can assign variables to items found in a regular expression, then I could use something like...
temp = temp.replace(/(<a * href="$1" *>)/ig,$1);
Umm, is there a proper way to do that?
Thanks :)
Adam