I have input text that can be long HTML text with tags and so on. Example of input can be something like:
<p>Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipiscing elit.<p>
<p>%image1%</p>
<h2>Lorem ipsum</h2>
<p>Cum sociis natoque penatibus et magnis dis parturient montes.</p>
<p>%image2%</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
<p>%image3%</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
...
What would be the easiest way of finding all occurrences of text between %% characters and replacing that with <img src="image1.jpg">?
working example: http://codepad.org/20Oz3Vok