Simple regex to extract servername from LDAP CN

Hi,

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”:“server.domain.com” 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:

cn":"{{server:/(.*)./}}

produces this:

[“server.domain.”]

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?

cn":"{{server:/[^\.]+/}}