Forum Moderators: phranque
For information on how to get the most from this forum, please check out our forum charter [webmasterworld.com].
For more information on mod_rewrite and regular expressions, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim
In order to match a numeric range of 0-112, you have to cover all possible character combinations:
[0-9] for 0-9
[1-9][0-9] for 10-99
10[0-9] for 100-109
11[012] for 110-112
So the whole mess, when put together, looks like this:
^***\.***\.([0-9]¦[1-9][0-9]¦10[0-9]¦11[012])\.
You can shorten that slightly, to:
^***\.***\.([1-9]?[0-9]¦10[0-9]¦11[012])\.
(You can ignore the final 0-255 octet of the IP address, since all values are to be matched (accepted).
Replace the broken pipe "¦" characters with solid pipe characters before use; Posting on this forum modifies that character.
Jim
I need a confirmation if the below samples are correct:
1.
to block from ***.***.0.0 - ***.***.63.255 the condition looks like ^***\.***\.([0-9]¦[1-6][0-3])\.
2.
to block from ***.160.0.0 - ***.162.255.255 the condition looks like ^***\.16[0-2]\.
Thanks again.