I have tried to wrap my head around regex and have failed pretty miserably. Here is my problem.
how would you do the following with regular expressions in php.
<use xlink:href='#gpPt4' transform='translate([B][U]261.7,184.3[/U][/B]) scale([B][U]4.50[/U][/B])'/>
<use xlink:href='#gpPt4' transform='translate([B][U]261.7,184.3[/U][/B]) scale([B][U]4.50[/U][/B])' onclick="alert('a variable name from php')"/>
where the bolded/underlined sections (only used for emphasis, not actually in the text) are variable and change from line to line
ie i need to run this on a file with multiple lines similar to above with different numbers and be able to insert the alert with a variable sent in from php
to add slightly more information, the above lines are from an SVG (an XML based file type used for drawing infinitely scalable images) file. I am generating the SVG file using gnuplot (i think) and the output is many lines like the first line of code above. I was planning on reading in the file using PHP, changing it with regex, and writing it back out. If there is a better way of doing this please let me know.