private void testRegexToolStripMenuItem_Click(object sender, EventArgs e) { DataGridViewRow row = dataGridView1.CurrentRow; if (row == null) { return; } using (RegexTester t = new RegexTester(true)) { t.Find = (string)row.Cells["find"].Value; t.Replace = (string)row.Cells["replace"].Value; t.Multiline = (bool)row.Cells["multi"].FormattedValue; t.Singleline = (bool)row.Cells["single"].FormattedValue; t.IgnoreCase = !(bool)row.Cells["casesensitive"].FormattedValue; if (Variables.MainForm != null && Variables.MainForm.EditBox.Enabled) { t.ArticleText = Variables.MainForm.EditBox.Text; } if (t.ShowDialog(this) == DialogResult.OK) { row.Cells["find"].Value = t.Find; row.Cells["replace"].Value = t.Replace; row.Cells["multi"].Value = t.Multiline; row.Cells["single"].Value = t.Singleline; row.Cells["casesensitive"].Value = !t.IgnoreCase; } } }
static void Main(string[] args) { //double a = 32.2343; //double b = -435.564; //String s1 = a.truncstring(2); //String s2 = b.truncstring(2); // Test which strings match regular expression in parallel //RegexTester rt = new RegexTester(@"^DESIGNATIONS WITH\s\S*$"); RegexTester rt = new RegexTester(@"(?<=^(\d){5,7}-)\S*$"); rt.RunTests(); }
/// <summary> /// Called when the user presses the "Test" button. We perform the regex /// testing here and show the results to the user. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments.</param> private void TestBtn_Click(object sender, System.EventArgs e) { try { RegexTester tester = new RegexTester(); using (new CursorChanger(this, Cursors.WaitCursor)) { ResultTxt.Text = tester.ModifyWithRegex(SampleTxt.Text, RegexTxt.Text, ReplacementTxt.Text, IgnoreCaseChk.Checked); } // If we made it here, the regular expression is valid. InvalidNoticeLbl.Visible = false; } catch (RegexTesterException) { // Invalid regular expression. ResultTxt.Clear(); InvalidNoticeLbl.Visible = true; } }
private void copyToRegexTesterToolStripMenuItem_Click(object sender, EventArgs e) { using (RegexTester t = new RegexTester(true)) { t.Find = RegexTextBox.Text; t.IgnoreCase = !CaseSensitiveCheckBox.Checked; t.Multiline = MultiLineCheckBox.Checked; t.Singleline = SingleLineCheckBox.Checked; if (t.ShowDialog(this) != DialogResult.OK) { return; } RegexTextBox.Text = t.Find; CaseSensitiveCheckBox.Checked = t.IgnoreCase; MultiLineCheckBox.Checked = t.Multiline; SingleLineCheckBox.Checked = t.Singleline; } }
private void testIfNotContainsToolStripMenuItem_Click(object sender, EventArgs e) { RegexTester.Test(ParentForm, IfNotContainsTextBox, null, IfIsMultilineCheckbox, IfIsSinglelineCheckBox, IfIsCaseSensitiveCheckBox); }
private void TestFind_Click(object sender, EventArgs e) { RegexTester.Test(ParentForm, ReplaceTextbox, WithTextbox, ReplaceIsMultilineCheckBox, ReplaceIsSinglelineCheckbox, ReplaceIsCaseSensitiveCheckBox); }
private void regexTesterToolStripMenuItem_Click(object sender, EventArgs e) { RegexTester rt = new RegexTester(); rt.Show(); }