From owner-freebsd-questions@FreeBSD.ORG Fri Jan 15 09:04:12 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EE531065676 for ; Fri, 15 Jan 2010 09:04:12 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id C39188FC14 for ; Fri, 15 Jan 2010 09:04:11 +0000 (UTC) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.4/8.14.3) with ESMTP id o0F943T8030879 for ; Fri, 15 Jan 2010 09:04:05 GMT (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk o0F943T8030879 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infracaninophile.co.uk; s=201001-infracaninophile; t=1263546245; bh=2P5abnolo163VAW8RrmCwHWyJM3aY/9/V4xCSNFXzyw=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4B502F7D.3000107@infracaninophile.co.uk>|Date:=20F ri,=2015=20Jan=202010=2009:03:57=20+0000|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.23=20(X11/20091129)|MIME-Vers ion:=201.0|To:=20freebsd-questions@freebsd.org|Subject:=20Re:=20Re gular=20Expression=20Editor|References:=20=09<866374fs5q.fsf@blue.stonehenge.com>=20|In-Reply-To:=20|X-Enigmail-Version:=200.9 5.6|Content-Type:=20multipart/signed=3B=20micalg=3Dpgp-sha256=3B=0 D=0A=20protocol=3D"application/pgp-signature"=3B=0D=0A=20boundary= 3D"------------enigA2F0D72D4E2D725FDA1317F9"; b=dh6OpkIZgC5vpyGJBL00qb52ofp2R9SzPtkI5CaGZpIKsaC2axtF1/TsWmnv1ZqZc 7rpFIRVCddvTsHUwRD4ucE7ofJCSEEMgQ35ht37to7yk3Oz5pyUC6ngifcUTF0GZhx kiyt68P8bG+ZOgv/iQpQh9Qac5e50QzJmwS3NNkY= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4B502F7D.3000107@infracaninophile.co.uk> Date: Fri, 15 Jan 2010 09:03:57 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.23 (X11/20091129) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <866374fs5q.fsf@blue.stonehenge.com> In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigA2F0D72D4E2D725FDA1317F9" X-Virus-Scanned: clamav-milter 0.95.3 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Subject: Re: Regular Expression Editor X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2010 09:04:12 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA2F0D72D4E2D725FDA1317F9 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Carmel wrote: > On Thu, 14 Jan 2010 10:38:41 -0800 > Randal L. Schwartz replied: >=20 >> You need to be specific about the kind of regex. While most regexp >> engines have common things like . and * and ^ and $, the meanings may >> vary a bit, and the more exotic things are certainly going to vary. >> >> (For example, despite the name, "Perl Compatible [sic] Regular >> Expressions" are *not* Perl compatible.) >> >> What tool are you using your regexes with? >=20 > OK, I was using RegExp Buddy on a Windows > machine. I would like to find something similar to it for a FreeBSD > environment. The expressions I create are used primarily with 'sieve' > in conjunction with Dovecot. I am also thinking of possibly creating a > few for use with Postfix. >=20 I believe dovecot simply uses the standard posix 'extended regular expression' syntax as seen in programs like grep(1). [See: http://ietfre= port.isoc.org/idref/draft-ietf-sieve-regex ]=20 In principle, this means you can write your test data into a file, and test it by running it through grep(1) using the -E flag: grep -E 'foo@(bar|baz)\.org' < testdata.txt Postfix uses PCRE by default. You can do the same sort of trick there: just run 'pcregrep' rather than 'grep -E' However, note that the regexes in dovecot sieve scripts are subject to a level of shell expansion. (Not sure what happens with postfix.) This means various special characters are going to need to be escaped by preceding them with a *pair* of backslashes. So, in the example above, the bit that says '\.' (meaning override the usual meaning of '.' as a wildcard that will match any character, and instead match a literal '.') would have to be entered into your sieve script as '\\\.' If in doubt, simply pound on the backslash key a few more times... Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigA2F0D72D4E2D725FDA1317F9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAktQL4MACgkQ8Mjk52CukIzjCACfcqU3vgcenoE4zeeIE97d2K3C kQsAniiLBfWLoXDNTd/K0Mz8L3UiSrvR =2etF -----END PGP SIGNATURE----- --------------enigA2F0D72D4E2D725FDA1317F9--