title: Set Variable if ValidatePattern Throws an Error Powershell
body: <p>is there by chance a way to set a variable equal to a message if the ValidatePattern fails? I know I can set ErrorMessage, but I'd also like to set my variable to show that it failed as well if the Validate Pattern fails. An example of what I'm attempting to do is below.</p>
  <pre><code>[ValidatePattern(&quot;[a-z]&quot;, $output.Test = &quot;Input failed. The input must contain a lower case character&quot;)]
  </code></pre>
  <p>And it currently shows an error for $output.test as &quot;Attribute Argument must be a constant or a script block. Is there any work around for this?</p>
  <p>Thanks!</p>