title: Parser using RegEx and XML, in C#
body: <p>I am making an application where I need to verify the syntax of each line which contains a command involving a keyword as the first word.<br>
  Also, if the syntax is correct I need to check the type of the variables used in the keywords. </p>
  
  <p>Like if there's a print command:</p>
  
  <pre><code>  print "string" &lt; variable &lt; "some another string" //some comments
  
    print\s".*"((\s?&lt;\s?".*")*\s?&lt;\s?(?'string1'\w+))?(\s*//.*)?
  </code></pre>
  
  <p>So i made the following Regex:</p>
  
  <pre><code>  \s*[&lt;&gt;]\s*((?'variant'\w+)(\[\d+\])*) 
  </code></pre>
  
  <p>This is to access all words in variant group to extract the variables used and verify their type.<br>
  Like this my tool has many keywords and currently I am crudely writing regex for each keyword. And if there's a change tomorrow I would be replacing the respective change everytime everywhere in every keyword.<br>
  I am storing a Regex for each keyword in an XML file. However I was interested in making it extensible, where say the specification changes tomorrow so I need to change it only once and it would reflect in all the places something like I transform the print regex to:</p>
  
  <pre><code>print %string% (%&lt;% %string%|%variable%)* %comments%
  </code></pre>
  
  <p>Now like this, I write a specification for each keyword and write the definition of string, variable, comments in another file which stores their regex. Then I write a parser which parses this string and create a regex string for me. </p>
  
  <p>Is this possible? </p>
  
  <p>Is there any better way of doing this or is there any way I can do this in XML?</p>