in reply to Regex for AD Organizational Units

You were almost there!

s/.+?(?=DC=)//;

i.e. "remove the shortest string followed by DC=".

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Regex for AD Organizational Units
by jzelkowsz (Novice) on Jul 11, 2019 at 18:13 UTC
    Thank you, choroba! This is working very well.