title: How to make a powershell textbox accepts only alphabetical or numeric character?
body: <p>I'm making with powershell a windows form textbox and need users type only numeric or alphabetical characters.</p>
  
  <p>I've found this using in c#</p>
  
  <pre><code>System.Text.RegularExpressions.Regex.IsMatch(textBox1.Text, "^[a-zA-Z ]")
  </code></pre>
  
  <p>May be there is a way to adapt it in powershell or not</p>
  
  <p>A part of my code</p>
  
  <pre><code>...
  # TextBox
  $textbox = New-Object System.Windows.Forms.TextBox
  $textbox.AutoSize = $true
  $textbox.Location = New-Object System.Drawing.Point(150,125)
  $textbox.Name = 'textbox_sw'
  $textbox.Size = New-Object System.Drawing.Size(220,20)
  $textbox.Text = "Max11car"
  $textbox.MaxLength = 11
  $form.Add_Shown({$form.Activate(); $textbox.Focus()}) # donne le focus à la text box
  #$textbox = New-Object System.Text.RegularExpressions.Regex.IsMatch($textbox.Text, "^[a-zA-Z0-9 ]")
  #$textbox = New-Object System.Text.RegularExpressions.Regex($textbox.Text, "^[a-zA-Z0-9 ]")
  ...
  </code></pre>
  
  <p>I expect the output will be something like this AbCDef45 and not Ab%$58</p>