Date: Mon, 01 Dec 2008 06:36:36 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Drew Tomlinson <drew@mykitchentable.net> Cc: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: Regular Expression Help Message-ID: <493385F4.6010809@infracaninophile.co.uk> In-Reply-To: <4932E8A2.6030804@mykitchentable.net> References: <4932CA0D.8080109@mykitchentable.net> <4932D91F.5040804@infracaninophile.co.uk> <4932E8A2.6030804@mykitchentable.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?493385F4.6010809>