So I bought a book on Perl the other day which had a large chapter on regular expressions (these are crazy programming things that make text go). I'd been wanting to learn how to use them for a long time rather than hacking my way stupidly through my occasional uses of them like an idiot.
With the help of "Perl For Dummies" and many online resources, I seem to have achieved that dream by stamping out a dumb bug that had been nagging at me for the past six months or so. Here is what I spent my morning making:
$text = preg_replace("|\[comic\](\d+)\[/comic\]|e", "returncomic(\\1)", $text);
Seriously. All morning.
This fixes the only-one-comic-per-message bug.
You can now post multiple comics in posts in the forums. Observe:
This is comic 100:
100
This is comic 200:
200
This is comic 1500:
1500
As with everything I ever add to this site, I'm a little wary of this getting abused. I think it could be very fun and helpful for people who use it nicely, but it could easily turn into a comic spam-fest which may annoy people and waste bandwidth at the time.
For now I'll be all trusting and naive and stuff and hope it doesn't get abused, but I can easily put limits in if it's required. Over and out.