title: Regular expression multiline validator
body: <p>In my ASP.NET Web Form I have a multiline <code>TextBox</code> which should be validated with RegularExpression Validator. Text box should contain one or more strings "a" (just 'a' char, nothing else).</p>
  
  <p>So far I got these regular expressions for my <code>RegularExpressionValidator</code> object:</p>
  
  <pre><code>(?m:(^a$)+)
  (?m:\A(^a$)+\Z)
  (?m:^a$)
  </code></pre>
  
  <p>and some others. Neither works. Guess there is something fundamental I'm not getting yet.</p>
  
  <p>Could you please tell me where I'm wrong?</p>
  
  <p>Here's the code involved.</p>
  
  <p>A Button (just for postbacks):</p>
  
  <pre><code>&lt;asp:Button ID="Button1" runat="server" Text="Button" /&gt;
  </code></pre>
  
  <p>The TextBox:</p>
  
  <pre><code>&lt;asp:TextBox ID="TextBox1" runat="server" Rows="10" TextMode="MultiLine"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>And the regex validator:</p>
  
  <pre><code>&lt;asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
      ControlToValidate="TextBox1" ErrorMessage="RegularExpressionValidator" 
      ValidationExpression="(?m:(^a$)+)"&gt;&lt;/asp:RegularExpressionValidator&gt;
  </code></pre>
  
  <p>There is nothing else on that Web Form. I've only added those controls and modified properties. I've even did all this using VS GUI.</p>
  
  <hr>
  
  <p>Using CustomValidator and doing <code>Regex.Match(TextBox1, @"(?m:(^a$)+)")</code> in it works just fine. Something is wrong with RegularExpressionValidator I guess.</p>