title: Regex - Quantifier {x,y} following nothing
body: <p>I'm creating a basic text editor and I'm using regex to achieve a find and replace function. To do this I've gotten this code:</p>
  
  <pre><code>Private Function GetRegExpression() As Regex
      Dim result As Regex
      Dim regExString As [String]
      ' Get what the user entered
      If TabControl1.SelectedIndex = 0 Then
          regExString = txtbx_Find2.Text
      ElseIf TabControl1.SelectedIndex = 1 Then
          regExString = txtbx_Find.Text
      End If
  
      If chkMatchCase.Checked Then
          result = New Regex(regExString)
      Else
          result = New Regex(regExString, RegexOptions.IgnoreCase)
      End If
  
      Return result
  End Function
  </code></pre>
  
  <p>And this is the <strong>Find</strong> method</p>
  
  <pre><code> Private Sub FindText()
      ''
      Dim WpfTest1 As New Spellpad.Tb
      Dim ElementHost1 As System.Windows.Forms.Integration.ElementHost = frm_Menu.Controls("ElementHost1")
      Dim TheTextBox As System.Windows.Controls.TextBox = CType(ElementHost1.Child, Tb).ctrl_TextBox
      ''
      ' Is this the first time find is called?
      ' Then make instances of RegEx and Match
      If isFirstFind Then
          regex = GetRegExpression()
          match = regex.Match(TheTextBox.Text)
          isFirstFind = False
      Else
          ' match.NextMatch() is also ok, except in Replace
          ' In replace as text is changing, it is necessary to
          ' find again
          'match = match.NextMatch();
          match = regex.Match(TheTextBox.Text, match.Index + 1)
  
      End If
  
      ' found a match?
      If match.Success Then
          ' then select it
          Dim row As Integer = TheTextBox.GetLineIndexFromCharacterIndex(TheTextBox.CaretIndex)
          MoveCaretToLine(TheTextBox, row + 1)
          TheTextBox.SelectionStart = match.Index
          TheTextBox.SelectionLength = match.Length
  
      Else
          If TabControl1.SelectedIndex = 0 Then
              MessageBox.Show([String].Format("Cannot find ""{0}""   ", txtbx_Find2.Text), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information)
          ElseIf TabControl1.SelectedIndex = 1 Then
              MessageBox.Show([String].Format("Cannot find ""{0}""   ", txtbx_Find.Text), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information)
          End If
          isFirstFind = True
      End If
  End Sub
  </code></pre>
  
  <p>When I run the program I get errors:</p>
  
  <ul>
  <li>For <code>?</code>, <code>parsing "?" - Quantifier {x,y} following nothing.</code>; and</li>
  <li>For <code>*</code>, <code>parsing "*" - Quantifier {x,y} following nothing.</code></li>
  </ul>
  
  <p>It's as if I can't use these but I really need to. How can I solve this problem?</p>