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:]]*)+$/
Start at the beginning of the line.
Match zero or more non-alpha characters, followed by GB or US,
Follow that with zero or more non-alpha characters
match the previous pattern 1 or more times.
Follow with the end of a line.
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?)+$/
But there are two special cases that need to be considered:
XX - private address space
** - addresses unassigned at the time the cc.gif file was last updated.
So, you may want to add those "countries" into the inner match... Note that
** would need to be escaped as \*\*
--
Daniel J McDonald, CCIE # 2495, CISSP # 78281