re.split question
bragib at my-deja.com
bragib at my-deja.com
Thu Jun 22 09:07:24 EDT 2000
More information about the Python-list mailing list
Thu Jun 22 09:07:24 EDT 2000
- Previous message (by thread): Linux/NT python startup speed
- Next message (by thread): re.split question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This goes using re: >>> p = '\,' >>> pat = re.compile(p, re.IGNORECASE) >>> t = 'uid=joe, ou=orgunit, o=some\\org' >>> pat.split(t) ['uid=joe', ' ou=orgunit', ' o=some\\org'] In article <m3k8fiosky.fsf at gondolin.beleriand>, Steffen Ries <steffen.ries at sympatico.ca> wrote: > Hi, > > 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. > > e.g. > "uid=joe, ou=orgunit, o=some org" > should be split into ["uid=joe", "ou=orgunit", "o=some org"] > > "uid=joe, ou=org\\, unit, o=some org" > -> ["uid=joe", "ou=org\\, unit", "o=some org"] > > Is there a way to use re.split to achieve this? (I solved it searching > [^\\], and splitting the string in a loop, but I was wondering if it > can be done easier.) > > TIA, > /steffen > -- > steffen.ries at sympatico.ca <> Gravity is a myth -- the Earth sucks! > Sent via Deja.com http://www.deja.com/ Before you buy.
- Previous message (by thread): Linux/NT python startup speed
- Next message (by thread): re.split question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list