$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個字符串。首先我想:Perl正則表達式替換並保存到變量
$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字符串,應該有合適的模塊來解析它。 – TLP 2012-07-10 18:27:47