Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

I suck at regex

Name: Anonymous 2008-11-15 20:43

Right. I'm trying to ban certain IP ranges via a rewrite rule in .htaccess.

If I want to ban 123.123.0.0 to 123.128.255.255 I enter
123\.(12[3-8]) which works fine.

However, I'm having trouble with ranges such as 123.123.0.0 to 123.138.255.255. In this example, I use two expressions:
123\.(12[3-9])  Covers 123.123 through 123.129
123\.(13[0-8])  Covers 123.130 through 123.138

Is it possible to combine these two expressions into a single one?
Danke.

Name: Anonymous 2008-11-15 20:49

Yes, it is possible.

Name: Anonymous 2008-11-15 20:50

USE THE | LUKE!

Name: Anonymous 2008-11-15 20:51

123\.[(12[3-9])(13[0-8])], dude.

Name: 3 2008-11-15 20:53

>>4
Nice try, but no cigar.

Name: Anonymous 2008-11-15 20:54

>>3
:(){ :|:& };: AMI DOIN IT RITE?

>>4
Thanks for the example... now I've learned me something and feel less stupid.

Name: Anonymous 2008-11-15 20:55

ONE WORD, CIDR, THREAD OVER

Name: Anonymous 2008-11-15 21:04

Yeah, I should've gewgled moar before making a thread. :x
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55572

Name: Anonymous 2008-11-15 21:22

^123\.1(13[0-8]|2[3-9])\.

Name: Anonymous 2008-11-15 21:23

^123\.1(3[0-8]|2[3-9])\. *

Name: ​​​​​​​​​​ 2010-10-21 21:22

Name: Anonymous 2011-02-03 4:40


Don't change these.
Name: Email:
Entire Thread Thread List