title: Read string between certain character and after character
body: <p>I want users to create their own POS print file while following some rules. So I have small Parameters.txt file which can be modified by users. Inside that file there are some strings like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>&lt;CENTER&gt;&lt;BOLD&gt;My Header Text 
  Just some random no parameters input
  from user
  Date:&lt;NOWDATE&gt; Time:&lt;NOWTIME&gt;
  </code></pre>
  
  <p>I want to read everything between <code>&lt;&gt;</code> as <code>string1</code>, and everything that is not inside <code>&lt;&gt;</code> as separated <code>string2</code>.</p>
  
  <p>So <code>&lt;NOWDATE&gt;</code> would be parameter that is recognized by code and inserts Date instead of that string, but <code>Date:</code> would be just some text entered by user which would just be passed to POS printer as string.</p>
  
  <p>Also, users can do something like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>&lt;CENTER&gt;&lt;BOLD&gt;Today&lt;NOWDATE&gt;:&lt;NOWTIME&gt;
  </code></pre>
  
  <p>So instead of <code>&lt;CENTER&gt;</code> there would be some ESC/POS command inserted, same in place of <code>&lt;BOLD&gt;</code>, but <code>Today</code> would be just passed as normal string without anything changed.
  It can be all in one big string, but i need a way to distinguish strings inside <code>&lt;&gt;</code> and outside of <code>&lt;&gt;</code></p>
  
  <p>I know how to read string inside <code>&lt;&gt;</code>, currently I am playing with this</p>
  
  <pre class="lang-cs prettyprint-override"><code>private static string FindStringInBetween(string Text, string FirstString, string LastString)
  {
      string STRFirst = FirstString;
      string STRLast = LastString;
      string FinalString;
  
      int Pos1 = Text.IndexOf(FirstString) + FirstString.Length;
      int Pos2 = Text.IndexOf(LastString);
  
      FinalString = Text.Substring(Pos1, Pos2 - Pos1);
  
      return FinalString;
  }
  </code></pre>
  
  <p>But this will only get string inside first <code>&lt;&gt;</code>, and ignore everything else.<br>
  Can you recommend best way of achieving this? </p>