title: C# Regex Character Class / String Pattern - to identify exclamation mark
body: <p>I want to do something like this --- if an expression contains exclamation mark, error; else, no error. </p>
  
  <p>The expression may be a value itself or math/string function. Example as below: <br />
  expr = abc; <br />
  expr = 123; <br />
  expr = concatenate(123,abc); <br />
  expr = sin(0.5);</p>
  
  <p>I'm using Regex library to identify the string pattern.<br />
  For every of the expression above, they didn't prompt out error (expected result), except for the last expression "expr=sin(0.5)", it prompts out error! Which it supposingly not to do so.</p>
  
  <p>So just wonder if I've written the string pattern wrongly? Or which part of the code that I need to modify in order to get the correct result? </p>
  
  <p>Provided with my code:</p>
  
  <pre><code>if (Regex.IsMatch(_exprWithVariableValues, @"[.*!+.*]+"))
      _result = "Invalid value";
  else
      _result = "Correct";
  </code></pre>