 <p>Really no need to put the number of searches. And, actually this could be done<br> with a single regex. I can't remember if Dot-Net supports the <code>\G</code> anchor,<br> but this is really not necessary anyway. I left it in. </p> <p>Each Match:<br> Finds a new key.<br> Captures the keys sub-string matches at the end.<br> Advances the search position by just the key. </p> <p>So, sit in a Find loop.<br> On each match print the 'Key' capture buffer,<br> then print the capture collection 'Values' count. </p> <p>Thats all there is to it. </p> <p>The regex will search for overlapping keys. To change it to exclusive keys,<br> change the <code>=</code> to <code>:</code> as shown in the comments. </p> <p>You can also make it a little more specific. For example, change all the <code>\w</code>'s to <code>[A-Z]</code>, etc... </p> <p>The regex: </p> <pre><code> (?: ^ [ \d]* | \G ) (?&lt;Key&gt; \w+ ) #_(1) [ ]+ (?= (?: \w+ [ ]+ )* (?= \w ) (?: (?= # &lt;- Change the = to : to get non-overlapped matches (?&lt;Values&gt; \1 ) #_(2) ) | . )* $ ) </code></pre> <p>This is a perl test case </p> <pre><code> # $str = '2 6 AA TT PP AAATTCGAA'; # $count = 0; # # while ( $str =~ /(?:^[ \d]*|\G)(\w+)[ ]+(?=(?:\w+[ ]+)*(?=\w)(?:(?=(\1)(?{ $count++ }))|.)*$)/g ) # { # print "search = '$1'\n"; # print "found = '$count'\n"; # $count = 0; # # } # # Output &gt;&gt; # # search = 'AA' # found = '3' # search = 'TT' # found = '1' # search = 'PP' # found = '0' # # </code></pre>