re.split question

Aahz Maruch aahz at netcom.com
Fri Jun 23 10:03:15 EDT 2000


In article <m3k8fiosky.fsf at gondolin.beleriand>,
Steffen Ries  <steffen.ries at sympatico.ca> wrote:
>
>I'm trying use re.split to separate an LDAP Distinguished Name into
>its naming components. The naming components are of the form
>"attr=value" and they are separated by ",".
>
>The part, which I can't solve is, that "value" may contain the
>sequence "\,", which obviously does not separate a naming component.

Unfortunately, specifying a string to *not* use is one of the hardest
tasks for an re.  While it can be done, it basically makes your code
unreadable and unmaintainable to anyone except an re expert.  Cliff's
suggestion is probably the best other than what you're currently doing.
In any event, comment this section of code carefully.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Why don't they make poppasmarts or didjeridon'ts?  --Aahz



More information about the Python-list mailing list