On 7 October 2014 05:04, punit jain <contactpunitj...@gmail.com> wrote:

> it breaks. I tried multiple regex, however could not get it working.
> Any clue on regex changes to accomodate this ?
>
>
1. You said you have a regex, and that you can't get it working, but what
is it that isn't working?
2. This might not be applicable to your problem, but you code lacks
'strict' and 'warnings'.  Turning both of those  on usually helps expose
many kinds of silent bugs.
3. What is the source of your string?
4. Is it intended to be many ldap strings seperated by commas, or a single
ldap URI where one has an attribute called "ldap://uid"; ( ie:  your string
appears vaugely like a valid single LDAP string
http://tools.ietf.org/html/rfc2255#section-3 )



----
use strict;
use warnings;

use URI;
my $str = 'ldap:///uid=user1,ou=People,o=test.com,mailto:us...@test.com
,ldap:///uid=user2,ou=People,o=test.com,ldap:///uid=user3,ou=People,o=
test.com';

my $uri = URI->new( $str );
print $uri->dn; # uid=user1,ou=People,o=test.com,mailto:us...@test.com
,ldap:///uid=user2,ou=People,o=test.com,ldap:///uid=user3,ou=People,o=
test.com

---






-- 
Kent

*KENTNL* - https://metacpan.org/author/KENTNL

Reply via email to