TCL - Create a regexp which will return the first match in a repeating string : <p>I'm trying to create a regexp that will capture the first occurrence of a repeating string.</p>

<p>The string is a "list" of RSA certificates , in succession. I am only interested in the first. </p>

<p>The string looks like:</p>

<pre><code>-----BEGIN CERTIFICATE-----
CERT1..........
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
CERT2............
-----END CERTIFICATE-----
...
...
...
</code></pre>

<p>I've tried variations on the following , but it is returning the full list rather than the first item:</p>

<pre><code>set match [regexp {(-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----$).*} $certs matchAll firstCert]
</code></pre>
