private void ReplaceAllClick(object sender, RoutedEventArgs e) { if (Reporter.ToUser(eUserMsgKey.ReplaceAll, "Are you sure you want to Replace All occurrences of \"" + txtFind2.Text + "\" with \"" + txtReplace.Text + "\"?") == Amdocs.Ginger.Common.eUserMsgSelection.OK) { Regex regex = GetRegEx(txtFind2.Text, true); int offset = 0; editor.BeginChange(); foreach (Match match in regex.Matches(editor.Text)) { editor.Document.Replace(offset + match.Index, match.Length, txtReplace.Text); offset += txtReplace.Text.Length - match.Length; } editor.EndChange(); } }
private void ReplaceAllClick(object sender, RoutedEventArgs e) { if (MessageBox.Show("Are you sure you want to Replace All occurrences of \"" + txtFind2.Text + "\" with \"" + txtReplace.Text + "\"?", "Replace All", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) { Regex regex = GetRegEx(txtFind2.Text, true); int offset = 0; editor.BeginChange(); foreach (Match match in regex.Matches(editor.Text)) { editor.Document.Replace(offset + match.Index, match.Length, txtReplace.Text); offset += txtReplace.Text.Length - match.Length; } editor.EndChange(); } }