Forum Moderators: phranque
SetEnvIfNoCase Remote_Addr "987\.654\.321\.[0-9]+" keep_out
Thing is, now I need to open things up for one specific IP -- let's say it's:
987.654.321.55
My first thought was to include these two lines instead:
SetEnvIfNoCase Remote_Addr "987\.654\.321\.[0-4]+" keep_out
SetEnvIfNoCase Remote_Addr "987\.654\.321\.[6-9]+" keep_out
But then I realized those opened up .5 through .59 (I think?) and not just .55. Hmm.
How about this triplet?
SetEnvIfNoCase Remote_Addr "987\.654\.321\.[(0-4)(0-9)]+" keep_out
SetEnvIfNoCase Remote_Addr "987\.654\.321\.[5 (0-4)(6-9)]+" keep_out
SetEnvIfNoCase Remote_Addr "987\.654\.321\.[(6-9)(0-9)]+" keep_out
Or this single?
SetEnvIfNoCase Remote_Addr "987\.654\.321\.[^55]" keep_out
Shoot. Now I'm confusing myself:)
Here's hoping my Q makes some sense and/or there's a regex [etext.lib.virginia.edu] equivalent of a mod_rewrite bang. Help, please? Thanks!
SetEnvIfNoCase Remote_Addr "987\.654\.321\.([0-9]¦[1-4][0-9]¦5[0-46-9]¦[6-9][0-9]¦1[0-9][0-9]¦2[0-5][0-9])" keep_out
SetEnvIfNoCase Remote_Addr "987\.654\.321\.([0-9]¦[1-46-9][0-9]¦5[0-46-9]¦[12][0-9][0-9])" keep_out
You have to handle this a character at a time.
You can make this easier on yourself with a bit of a reading trick. For example, when faced with something like
[1-9][0-9]
read the left characters in the brackets first:
[1-9][0-9]
So that's 'start at 10'
then read the right characters:
[1-9][0-9]
'and end at 99'.
But never forget that regex assigns no meaning to these characters, they are just characters and not numeric 'values' as far as regex is concerned.
Jim