I found good tutorials on how to do a string replace all for a string, but how to replace from a to b ?
Lets say we have this selector
$('a.mylink')
This selector will return something like
<a class="micro_avatar my_avatar"></a>
<a href="#!/users/user_name" style="background:
url(https://secure.gravatar.com/avatar/randomnumber?size=24&default=mm)
no-repeat" class="micro_avatar"></a>
http://www.youtube.com/watch?v=_sgu7CioctU
In the page that Im testing this, will find multiple ocurrences of this w variations ( imagine a blog and each post have this inside).
Now we want to replace all the ocurrences to look like this
<a class="micro_avatar my_avatar"></a>
<a ** rel='nofollow' ** href="#!/users/user_name" style="background:
url(https://secure.gravatar.com/avatar/randomnumber?size=24&default=mm)
no-repeat" class="micro_avatar"></a>
**<iframe width="560" height="315" src="** http://www.youtube.com/embed/_sgu7CioctU
**" frameborder="0" allowfullscreen></iframe>**
The trick part is not all the youtube links will have the same link.
'a.mylink'won't match the html you've shown. What does$('a.mylink')have to do with the rest of your question? Are you saying the first code block is actually the content of a string and you want to change it to look like the second, or is that somewhere in your document's body, or...?