Validate that a PowerShell parameter is alphanumeric
<p>I simply want to validate that a parameter is only made up of alphanumeric characters. I've tried this, but it doesn't behave as I'd like:</p>

<pre><code>param(
    [ValidatePattern('[a-zA-Z0-9]')]$someVariableThatShouldOnlyContainAlphaNumerics = 'something_with_underscores'
)
write-host $someVariableThatShouldOnlyContainAlphaNumerics
</code></pre>

<p>Returns:</p>

<blockquote>
  <p>something_with_underscores</p>
</blockquote>

<p>I'm clearly missing something obvious. Any suggestions?</p>