Forum archives » System Notices » Brad: 1 | Regular Expressions: 0

Brad
October 15, 2001 2:06 PM

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.

Post #21792link

andydougan
October 15, 2001 2:18 PM

Wow! I'd say the forum is pretty much perfect now.

I must see this for myself!

30617

31705

Huzzah!

The only problem now, as you say, is that some people might display their entire collections in the one post. That'd get old fast.

Post #21796link

habnem
October 16, 2001 1:11 AM

...that'd only get *really* old if you reloaded with comics--now you'll just have to look at the whole page before you reload it...

Post #21877link

andydougan
October 16, 2001 5:29 AM

I've set my account to show the comics by default, though.

Post #21896link

gabe_billings
October 18, 2001 5:59 PM

Can I make a post with all 30,000+ comics in it?

Post #22350link

andydougan
October 18, 2001 6:41 PM

quote:
Can I make a post with all 30,000+ comics in it?

I doubt even you would not have the geekish stamina. But if you succeed in doing this thing, I'll let you sleep with any of my cats.

Post #22371link

wirthling
October 18, 2001 7:11 PM

quote:
quote:
Can I make a post with all 30,000+ comics in it?

I doubt even you would not have the geekish stamina. But if you succeed in doing this thing, I'll let you sleep with any of my cats.

Making a post like that could easily be accomplished with a script. Something like this JavaScript example...

for (var i = 0; i < 30001; i++)
{
document.write('

' + i + '

')
}

You could run that and then 'select all' on the resultant page, copy, and paste.

Oops. I probably shouldn't have posted this...

Post #22375link

andydougan
October 18, 2001 7:17 PM

quote:
I doubt even you would not have the geekish stamina.

Dang. I meant "I doubt even you would have the geekish stamina". I hate double negatives.

quote:
Making a post like that could easily be accomplished with a script. Something like this JavaScript example...

for (var i = 0; i < 30001; i++)
{
document.write('

' + i + '

')
}

You could run that and then 'select all' on the resultant page, copy, and paste.

Oops. I probably shouldn't have posted this...



Yeah, I never thought of using scripts. Perhaps there should be some sort of limit on the number of comics in one post.

Post #22378link

Brad
October 18, 2001 9:34 PM

Yay, more work to do!

Post #22425link

kaufman
October 19, 2001 9:33 AM

quote:
Can I make a post with all 30,000+ comics in it?
Beware, C40K is nearly upon us!

Post #22479link

Forum archives » System Notices » Brad: 1 | Regular Expressions: 0

stripcreator
Make a comic
Forums
featuring
diesel sweeties
jerkcity
exploding dog
goats
ko fight club
penny arcade
chopping block
also
Brad Sucks