【发布时间】:2012-07-10 17:55:57
【问题描述】:
$LDAP = ldap://sspdir.managed.entrust.com/ou=Entrust Managed Services SSP CA,ou=Certification Authorities,o=Entrust,c=US?cACertificate;binary,crossCertificatePair;binary
我正在尝试从此代码 ldap 目录中提取 2 个字符串。我想要的第一个:
$LDAP_host = sspdir.managed.entrust.com
第二个……
$LDAP_base = ou=Entrust Managed Services SSP CA,ou=Certification Authorities,o=Entrust,c=US
我的代码在下面,它在我的输出中产生了不断的不匹配,我不知道为什么:
my $LDAP_host = $LDAP;
my $LDAP_base = $LDAP;
$LDAP_host =~ s|^ldap:\/\/(.*)\/|$1|i;
$LDAP_base =~ s|"\/"(.*)\?|$1|i;
【问题讨论】:
-
如果这是一个LDAP字符串,应该有一个合适的模块来解析它。
标签: regex perl variables extract