Re: Parse x.500 DN and change order displayed

On Mar 31, 8:26=A0am, Hallvard B Furuseth <h.b.furus... [at] usit.uio.no>
wrote:
> SecureIT writes:
> > I am trying to change this
> > "cn=3DBob Smith+serialNumber=3DCR013120080827,o=3DICM,c=3DUS"
> > to this:
> > "serialNumber=3DCR013120080827+cn=3DBob Smith,o=3DICM,c=3DUS"
>
> Without escape sequences like "\," and "\+" in the DNs (if that's
> allowed anyway, I don't remember the details of X.500 Dn syntax), this
> moves serialNumber first in each RDN:
>
> s/(^|,)([^,]*)\+(serialNumber=3D[^+,]*)(?=3D[+,])/$1$3+$2/gi ;
> die "didn't catch all 'foo+serialNumber's" if /\+serialNumber=3D/i;
>
> --
> Hallvard

That worked great, thanks so much. Just ran it and all 2000 DN's are
properly formatted now.

-G
SecureIT [ Mo, 31 März 2008 18:20 ] [ ID #1931984 ]
Perl » comp.lang.perl.misc » Re: Parse x.500 DN and change order displayed

Vorheriges Thema: Re: empty variables - getting rid of "uninitialized value" warnings?
Nächstes Thema: FAQ 8.6 How do I check whether input is ready on the keyboard?