internal static void FindRegex(TextBoxBase textBox, Regex regex)
{
Match match = regex.Match(textBox.Text, textBox.SelectionLength == 0 ? textBox.SelectionStart : textBox.SelectionStart + textBox.SelectionLength);
if (!match.Success)
{
WikiPad.FindForm.ShowFormattedMessageBox("No further occurences of RegularExpression \"{0}\" have been found.", regex.ToString());
return;
}
textBox.SelectionStart = match.Index;
textBox.SelectionLength = match.Length;
textBox.ScrollToCaret();
}