Let's say we have 2 php variables:
- $name = 'caption';
- $url = 'http://domain.com/photo.jpg';
The input string of '{@url,<img src="," alt="{@name}" />}'
should return:
'<img src="http://domain.com/photo.jpg" alt="caption" />'
The {tag}
takes up to 3 parameters: {@variable[,text_before][,text_after]}
.
What regex would be needed to make this happen? The tricky part is that a {@..}
tag is nested within another.