Hi all,
I need to extract information from an LDAP connection string like this one:
ldap://uid=adminuser,dc=example,c=com:[email protected]/dc=basePath,dc=example,c=com
I want to use a regular expression that will extract each token for me and place it in an array. I tried some regex expression and the best I got was this:
/(\w+)\:\/\/(([a-zA-Z0-9]+)(:([^\:\@]+))?@)?([^\/]+)((\/[^#]*)?(#(.*))?)/
But unfortunately, when I execute it in PHP, I get the following result:
Array
(
[0] => ldap://uid=adminuser,dc=example,c=com:[email protected]/dc=basePath,dc=example,c=com
[1] => ldap
[2] =>
[3] =>
[4] =>
[5] =>
[6] => uid=adminuser,dc=example,c=com:[email protected]
[7] => /dc=basePath,dc=example,c=com
[8] => /dc=basePath,dc=example,c=com
)
Can anybody help me so that I can correctly extract each part of the connection string?
Thanks