[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Regex pattern for LDIF



On Die, 31 Okt 2000, Michael Ströder wrote:

>Thanks for the code (this prints out LDIF?). Pardon my Perl
>ignorance. I have written a LDIF-parser and -generator in Python.
>;-)

this sample perl-code prints out the LDIF-dataformat, such as it
"ldapsearch" does ;) you might have to modify the search/filter
criteria.....

>I was rather looking for a simple regex for checking if the user has
>entered LDIF in a web form. It does not have to be perfect. The
>parser raises exceptions if something is wrong anyway.

a simple REGEXP search might be:

s/^(.*)\:\s(.*)/

i often use an "global ldapsearch", and then i pipe this to "grep".

for example:

ldapsearch -L -D "o=DHW,c=DE" -D "uid=admin,o=DHW,c=DE" -w "xxxxxxx" \(objectclass=\*\) |grep -i XXXX

Greetings,

Joerg Henner.

-- 
LinuxHaus Stuttgart                    | Tel.:  +49 (7 11) 2 85 19 05
J. Henner & A. Reyer, Datentechnik GbR | D2:    +49 (1 72) 7 35 31 09
                                       | Fax:   +49 (7 11) 5 78 06 92
Linux, Netzwerke, Consulting & Support | http://lihas.de