Creating a Regular Expression Evaluator Program - Part 2

So I thought I would move straight onto an update to this Regular Expression Evaluator tool.  What I have done code wise is only 2 lines, but for functionality and ease of use, I have added three tabs, three text boxes and another button.

 

 

image

 

I have extended the program so it now offers the capability of performing a Regex.Replace.  You can then test out your patterns really quickly and easily before you try to integrate into your code.  being regular expressions, you can test for all languages and they are universal (nearly).

 

So I have added three tabs, each with a text box inside.  The names of these I have called:

  • txtPattern
  • txtAfterReplacement
  • txtExampleText

The code I have used for the second button function is as follows:

 
Hide Code [-]
        private void btnReplace_Click(object sender, EventArgs e)
        {
            Regex newExpression = new Regex(txtPattern.Text);
            txtAfterReplacement.Text = newExpression.Replace(txtExampleText.Text, txtReplacementText.Text);
        }
{..} Click Show Code
Published Thursday, April 24, 2008 9:27 PM by REA_ANDREW
Filed under:

Comments

# Creating a Regular Expression Evaluator Program - Andrew Rea

Pingback from  Creating a Regular Expression Evaluator Program - Andrew Rea

Leave a Comment

(required) 
(required) 
(optional)
(required)