Hi all,
Using regular expressions, I'd like to be able to convert any IMG tags into my own format (which allows less flexibility, but can be understood better by those who do not know HTML, IMO)
My format is simply {IMG :alignment:}:url:{/IMG} or just {IMG}:url:{/IMG}
I would like to use regular expressions because there is no way I can guarantee the order in which the attributes of the IMG tag will appear, thus rendering str_replace virtually useless without extra code to split up the tag into bits and check each one.
Is there a quicker way with regular expressions? For example, <img src="http://www.gazchap.com/blah.gif" align="left"> becomes {IMG LEFT}http://www.gazchap.com/blah.gif{/IMG}, as will the same HTML tag, but with the align attribute before the src.
All through this, replace the curly brackets with square brackets 😉
Muchos gracias, dudes (and dudettes of course!)