Hi Guys, In the following line: cn=portal.090710.191533.428571000,cn=groups,dc=mp,dc=rj,dc=gov,dc=br I need to extract this string: portal.090710.191533.428571000 As you can see this string always will be bettween "cn=" and "," strings. Someone know one regular expression to extract this string? Any help will be very much appreciated Best Regards Pierre
MyString = "1234567890" startPos = 3 charCount = 4 Print Mid$(MyString,startPos,charCount) ' Prints "3456"
Similarly, cn=portal.090710.191533.428571000,cn=groups,dc=mp, dc=rj,dc=gov,dc=br startPos = 4 charCount = 33 Print Mid$(MyString,startPos,charCount)
Hi naimish, I don“t understand your idea... I have the following code: if( /cn=/ ) { $result = $_; $result =~ s/^cn=([^,]*?),//; <-- MY REGEX EXPRESSION } return $result in this case your REGEX is returning cn=groups,dc=mp,dc=rj,dc=gov,dc=br I need the opposite result. I think a REGEX where in the first time remove the string cn= so the result string will be portal.090710.191533.428571000,cn=groups,dc=mp,dc=rj,dc=gov,dc=br The second REGEX will remove the entire string cn=groups,dc=mp,dc=rj,dc=gov,dc=br To be lefting only the needed string portal.090710.191533.428571000 Can you help me? Regards Pierre
my $str="cn=portal.090710.191533.428571000,cn=groups,dc=mp, dc=rj,dc=gov,dc=br"; if($str=~/cn=(.*),cn=/) { print $1; }
$a='cn=portal.090710.191533.428571000,cn=groups,dc=mp, dc=rj,dc=gov,dc=br'; $a=~ /p[\w.]*/; print"$&\n";