From owner-freebsd-questions@FreeBSD.ORG Mon Dec 1 06:36:51 2008 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 85BFE106564A for ; Mon, 1 Dec 2008 06:36:51 +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 0A57C8FC14 for ; Mon, 1 Dec 2008 06:36:50 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id mB16ahMU095361; Mon, 1 Dec 2008 06:36:44 GMT (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.7.2 smtp.infracaninophile.co.uk mB16ahMU095361 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1228113404; bh=RgCmYsMDtTuZNY fk6MKT6AI8YskeEhUWuJ6YEszO/vw=; h=Message-ID:Date:From:MIME-Version: To:CC:Subject:References:In-Reply-To:Content-Type:Cc:Content-Type: Date:From:In-Reply-To:Message-ID:Mime-Version:References:To; z=Mes sage-ID:=20<493385F4.6010809@infracaninophile.co.uk>|Date:=20Mon,=2 001=20Dec=202008=2006:36:36=20+0000|From:=20Matthew=20Seaman=20|Organization:=20Infracaninophile|User -Agent:=20Thunderbird=202.0.0.18=20(X11/20081125)|MIME-Version:=201 .0|To:=20Drew=20Tomlinson=20|CC:=20FreeBSD =20Questions=20|Subject:=20Re:=20Reg ular=20Expression=20Help|References:=20<4932CA0D.8080109@mykitchent able.net>=20<4932D91F.5040804@infracaninophile.co.uk>=20<4932E8A2.6 030804@mykitchentable.net>|In-Reply-To:=20<4932E8A2.6030804@mykitch entable.net>|X-Enigmail-Version:=200.95.6|Content-Type:=20multipart /signed=3B=20micalg=3Dpgp-sha256=3B=0D=0A=20protocol=3D"application /pgp-signature"=3B=0D=0A=20boundary=3D"------------enigE77D70B09862 C5E486412140"; b=fPhIJdhFweCRld20w+AtMnZb6oIQlyojmiIciz3AhsqbcasfMc JfZJGV7/Sb5tuugIyHGSZMmvz0ZQ3SKTPFyfxuX2JVZ26+0cVDbedsgK5tJ4jM4Mg37 pahgrvn8jVLzXR+r980WDJp9Tx1U9amsTwfM9MXffaBZfRV+ok3KGs= Message-ID: <493385F4.6010809@infracaninophile.co.uk> Date: Mon, 01 Dec 2008 06:36:36 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.18 (X11/20081125) MIME-Version: 1.0 To: Drew Tomlinson References: <4932CA0D.8080109@mykitchentable.net> <4932D91F.5040804@infracaninophile.co.uk> <4932E8A2.6030804@mykitchentable.net> In-Reply-To: <4932E8A2.6030804@mykitchentable.net> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigE77D70B09862C5E486412140" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (smtp.infracaninophile.co.uk [IPv6:::1]); Mon, 01 Dec 2008 06:36:44 +0000 (GMT) X-Virus-Scanned: ClamAV 0.94.2/8698/Sun Nov 30 15:09:19 2008 on 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 Cc: FreeBSD Questions Subject: Re: Regular Expression Help 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: Mon, 01 Dec 2008 06:36:51 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE77D70B09862C5E486412140 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Drew Tomlinson wrote: > Matthew Seaman wrote: >> % perl -p -e 's/cn=3D([^ ,]+) ([^,]+),/cn=3D$2 $1,/' < foo.txt=20 > I still don't really understand *why* the above works but I'm trying to= =20 > pick it apart now. The RE breaks down like this: /cn=3D([^ ,]+) ([^,]+),/ cn=3D Match literal text 'cn=3D' ( capture #1 begin [^ ,] Character class: anything that is not space or c= omma + At least one of the above ) end capture #1 Match a literal space ( capture #2 begin [^,] Character class: anything that is not a comma + At least one of the above ) end capture #2 , Match literal comma 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 --------------enigE77D70B09862C5E486412140 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.9 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkkzhfsACgkQ8Mjk52CukIxGvwCgkVhmWcapYq6lVOxbuJdhtYDd vHcAn1zUhhXsVkOt9kmDtbJjRXIsDCc3 =L8PS -----END PGP SIGNATURE----- --------------enigE77D70B09862C5E486412140--