On Fri, 20 May 2011 06:41:33 -0500 Daniel McDonald <dan.mcdon...@austinenergy.com> wrote:
> > > > On 5/19/11 7:55 PM, "Rapitharian" <rapithar...@hotmail.com> wrote: > > > > > RW-15 > > Can you help me some? I am not even a novice in writing/reading > > regular expressions. > > What is this doing? X-Relay-Countries=~ > > /^([^[:alpha:]]*(GB|US)[^[:alpha:]]*)+$/ > > Since the non-alpha characters will always be a single space, and > there is never a space in the first column, this would be more easily > written as: /^(?:(?:GB|US)\s?)+$/ [^[:alpha:]]* doesn't just match single spaces, it also matches the ** characters. I wrote it that way on the off-chance that additional special codes might be added in the future. For example if ?? were added to represent IPv6 addresses, they would be ignored by my rule, but /^(?:(?:GB|US|\*\*)\s?)+$/ would treat ?? as if it were a foreign country code. BTW does anyone know if there's a way to get the FreeBSD p5-IP-Country port to update its database. I just noticed it's nearly two years old.