Unfortunately I really cannot get my head around regular expressions so my last resort is to ask the help of you fine people.
I have this existing code:
<li id="id-21" class="listClass" data-author="newbie">
<div class="someDiv">
<span class="spanClass">Some content</span>
</div>
<div class="controls faint">
<a href="link2">Link 2</a>
<a href="link3">Link 3</a>
</div>
</li>
Due to a number of reasons, I have to use preg_replace to inject an additional piece of code:
<a href="link1">Link 1</a>
I think you can guess where that should go, but for the sake of clarity, my desire is for the resulting string to look like:
<li id="id-21" class="listClass" data-author="newbie">
<div class="someDiv">
<span class="spanClass">Some content</span>
</div>
<div class="controls faint">
<a href="link1">Link 1</a>
<a href="link2">Link 2</a>
<a href="link3">Link 3</a>
</div>
</li>
Can anyone help me with the appropriate regular expression to achieve this?
<a href="link1">Link 1</a>in front of<a href="link2">Link 2</a>???