예제 #1
0
        private void btnGen_Click(object sender, EventArgs e)
        {
            List <String> regexOutput = new List <String>();

            if (type == "Explicit")
            {
                regexOutput = RegexComputation.generateExplicitRegex(tbInput.Text);
            }
            else if (type == "Pattern")
            {
                regexOutput = RegexComputation.generatePatternRegex(tbInput.Text);
            }
            else
            {
                regexOutput = RegexComputation.generateRangeRegex(tbInput.Text);
            }

            DataTable dt = new DataTable();

            dt.Columns.Add("Regex");
            dt.Columns.Add("Worked");

            if (type == "Pattern")
            {
                foreach (String n in regexOutput)
                {
                    Console.WriteLine(n);
                    dt.Rows.Add(n, "Click Here To Test The Regex!");
                }
            }
            else
            {
                foreach (String n in regexOutput)
                {
                    Console.WriteLine(n);
                    dt.Rows.Add(n, Convert.ToString(RegexComputation.checkRegexWorks(n, tbInput.Text)));
                }
            }

            dgvOutput.DataSource = dt;
        }
예제 #2
0
 private void btnTest_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(tbTestString.Text) || String.IsNullOrWhiteSpace(tbTestString.Text))
     {
         MessageBox.Show("String To Test Cannot Be Empty!");
     }
     else
     {
         Boolean pass = RegexComputation.checkRegexWorks(regularExp, tbTestString.Text);
         if (pass == true)
         {
             btnShowPassed.BackColor = Color.Green;
             btnShowPassed.Text      = "Passed";
         }
         else
         {
             btnShowPassed.BackColor = Color.Red;
             btnShowPassed.Text      = "Failed";
         }
     }
 }