title: My regex match positive real numbers doesn't work
body: <p>I am reading from a TextBox in C# and I want to make sure that only real positive values are allowed (including integers).
  i.e. 1, 23, 23., 23.0, 23.42, etc.
  The Regex I am using is:</p>
  
  <p><code>[0-9]+\\.?[0-9]*</code></p>
  
  <p>But C# does only let me type numbers and I can never put a period.</p>
  
  <p>Thank you</p>
  
  <p>Code:</p>
  
  <pre><code>    private static readonly Regex rgx_onlyPositiveReals = new Regex("[0-9]+\\.?[0-9]*"); 
  
      private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
      {
          e.Handled = !IsSamplingRateAllowed(e.Text);
  
      }
  
      private static bool IsSamplingRateAllowed(string text)
      {
          if(rgx_onlyPositiveReals.IsMatch(text))
          {
              if(text.Equals(".") || float.Parse(text) &lt;= 0.0)
              {
                  MessageBox.Show("Sampling Rate has to be positive.", "Wrong Sampling Frequency Error", MessageBoxButton.OK, MessageBoxImage.Error);
                  return false;
              }
              return true;
          }
          return false;
      }
  </code></pre>