CN=steffenr,OU=Users,OU=Accounts,DC=big-company,DC=comI need the part between the '=' and the first comma.
The naive approach in Ruby is
But this gives us "CN=steffenr,OU=Users,OU=Accounts,DC=big-company" because the algorithms is greedy. What we want is to stop before the first comma. The solution is to use a negative look-ahead.
rubular.com offers an interactive console to debug a regexp. Voilá.