[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: regexp spam filter



On Mon, May 20, 2002 at 02:19:28PM -0700, Alan Su wrote:
> the following regexp *should work:
> 
>  217\.78\.(6(4|5|6|7|8|9)|7(0|1|2|3|4|5|6|7|8|9))\.[0-9]+
> 
> it's not really obscure, but it's not really all that clever either.
> =)  i'm sure there are more "compact" solutions out there!

Slightly more compact would be to use character classes:

  217\.78\.(6[4-9]|7[0-9])\.[0-9]+

Both this and the above depend on what tool you're using. These are Perl
regexps or extended regexps (not the same thing, but compatible in this
case); if you're in something that uses basic regexps instead (e.g.
grep, by default), then you want:

  217\.78\.\(6[4-9]\|7[0-9]\)\.[0-9]\+

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: