title: Should RegEx be stored in XML as CDATA or as Attributes?
body: <p>I am trying to output a <code>RegEx</code> in an xml file as an Attribute.</p>
  
  <p>The problem is that the RegEx generated in the XML output is different than the one i have in Database:</p>
  
  <pre><code>-- database
  [a-z0-9!#$%&amp;amp;&amp;apos;*+\/=?^_`{|}~-]+(\.[a-z0-9!#$%&amp;amp;&amp;apos;*+\/=?^_`{|}~-]+)*@([a-z0-9_-]+\.)+(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|[a-z]{2})
  
  -- generated
  [a-z0-9!#$%&amp;amp;amp;&amp;amp;apos;*+\/=?^_`{|}~-]+(\.[a-z0-9!#$%&amp;amp;amp;&amp;amp;apos;*+\/=?^_`{|}~-]+)*@([a-z0-9_-]+\.)+(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|[a-z]{2})
  </code></pre>
  
  <p>Should i save the RegEx as a <code>&lt;![CDATA[ regex ]]&gt;</code> or is this just the default behavior of xml files (encoding some characters and decode them automatically when i read it back) ?</p>
  
  <p>This is the code i have to generate the element:</p>
  
  <pre><code>XElement attr =
      new XElement("Attribute",
          new XAttribute("RegEx", item.RegularExpression)
      );
  </code></pre>
  
  <p>And this is what it generates:</p>
  
  <pre><code>&lt;Attribute RegEx="[a-z0-9!#$%&amp;amp;amp;&amp;amp;apos;*+\/=?^_`{|}~-]+(\.[a-z0-9!#$%&amp;amp;amp;&amp;amp;apos;*+\/=?^_`{|}~-]+)*@([a-z0-9_-]+\.)+(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|[a-z]{2})" /&gt;
  </code></pre>