Regex to get values from a string using C#
<p>I have posted this earlier but did not give clear information on what i was trying to achieve. </p>

<p>I am trying get values from a string using Regex in c#. I am not able to understand why some values i could get and some i can not using a similar approach.</p>

<p>Please find the code snippet below. 
Kindly let me know what i am missing.
Thanks in advance.</p>

<pre><code>string text = "0*MAO-001*20160409*20160408*Encounter Data Duplicates Report       *     *ENC000200800400120160407*PRO*PROD*";

//toget the value 20160409 from the above text
//this code works fine
Regex pattern = new Regex(@"([0][*]MAO[-][0][0][1].*?[*](?&lt;Value&gt;\d+)[*])");
Match match = pattern.Match(text);
string Value = match.Groups["Value"].Value.ToString();



//to get the value ENC000200800400120160407 from the above text
// this does not work and gives me nothing
Regex pattern2 = new Regex(@"([0][*]MAO[-][0][0][1].*?[*].*?[*].*?[*].*?[*].*?[*](?&lt;Value2&gt;\d+)[*])");
Match match2 = pattern.Match(text);
string Value2 = match.Groups["Value2"].Value.ToString();
</code></pre>