Forum Moderators: phranque

Message Too Old, No Replies

more help with IP range

aaa.bb.64.0-aaa.bb.127.255

         

nancyb

1:41 am on Nov 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to ban the entire IP range between
aaa.bb.64.0-aaa.bb.127.255

Been reading regex tutorials and examples for hours. I'm sure it will be really simple - once it gets through my thick skull, but I'm lost after:

^aaa\.bb\.(6[4-9]

Thanks!

jdMorgan

1:51 am on Nov 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Range aaa.bb.64.0 - aaa.bb.127.255

^aaa\.bb\.(6[4-9]¦[7-9][0-9]¦1[01][0-9]¦12[0-7])\.

Jim

nancyb

2:09 am on Nov 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you, Jim!

nancyb

2:17 am on Nov 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



'nother question ...

what is the period (.) on the end for?

jdMorgan

2:30 am on Nov 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To denote the beginning of the next octet, which I omitted from the pattern because it ranges from 0 to 255 - the entire valid/possible range.

You could leave it off in this case because the previous octet is expressed in three digits, but I do it out of habit to avoid serious problems if the previous octet is only one or two digits.

To show what I mean, take the pattern

^123\.45\.67

That's OK, because "67" must be the whole octet, since "670" is greater than 255 and would be invalid.

But take the pattern:

^54\.32\.1

That will match 54.32.1, but it will also match 54.32.10 or 54.32.101, and all three are valid! :o

Throwing the dot on the end forces it to stop matching after the specified number of digits.

Jim

nancyb

4:46 am on Nov 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thank you for the clear explanation and all the past and present help :)