<p>I have the following string:</p>

<pre><code>cn=abcd,cn=groups,dc=domain,dc=com
</code></pre>

<p>Can a regular expression be used here to extract the string after the first <code>cn=</code> and before the first <code>,</code>? In the example above the answer should be <code>abcd</code>. </p>

Yeah, using perl/java syntax
```
cn=([^,]*),
```
. You'd then get the 1st group.