Hi all,
given a string:
" <img class='myclass' alt='my picture' src='image.jpg' /"
(where alt and src are changeable)
how do I create the following string:
" <div class='container'>
<div class='inner'>
<img class='myclass' alt='my picture' src='image.jpg' />
<p>my picture</p>
</div>
</div"
(where the contents of <p></pare the same as the image 'alt') ?
I believe a regular expression would solve this but I'm not sure on the
syntax.
something like:
regex.replace("<img class='myclass' alt='$1' src='$2' />","<div
class='container'><div class='inner'><img class='myclass' alt='$1'
src='$2' /><p>$1</p></div></div>")
Any ideas? Thanks!
--
fiddlewidawiddum