Simple regex to extract servername from LDAP CN


I’ve got a really simple problem but I’ve been losing my mind over this today.

I’m extracting a list of servers using an ldap query and having an incoming string of “cn”:“” in each loop step. I want to retrieve ‘server’ via regex.

After many attempts and some ‘hit-and-hoping’ I’ve got it a point where this regex:


produces this:


This is as close as I’ve had it but don’t know enough about regex to understand why it’s jumping the first full-stop\period. Please could someone help?