Dear Readers,
I'd like to think that I'm a decent PHP coder, but one thing I haven't really dipped my head into are regular expressions. I need to replace a series of custom tags in a variable with different ones. I can do this with several substr_replace()s, but I'm sure it can be done with a single preg_replace().
I have a variable called $story, which holds several tags of the sort:
<<<picname.jpg>r>
and
<<<picname.jpg>l>
These are placeholders for where pictures should be. Basically the former should become
<a href='picname.jpg'><img src='thumbs/picname.jpg' border='0' align='right'></a>
...and the latter the same with left alignment.
As I said, it's most likely quite easy for someone versed in the hieroglyphs that are regular expressions. 🙂 Any help would be most appreciated!