RegexStudio Documentation

The premier Regular Expression development environment for .Net

Testing Regular Expressions

The Test tab contains all the features you need to try out your newly created regular expression. The first thing you’ll notice is the regular expression field, which duplicates the content of the identically named field on the Create tab. This is for convenience, because there are times when you want to make edits to your regular expression while testing, but you don’t want to switch between tabs.
 

The Test Tab:


On the far right of the window, you’ll see a set of radio buttons that let you choose what mode to test in. Regular expressions in .net can be used in three modes, as follows:



As you choose a different radio button, different fields on the Test tab are enabled or disabled, depending on what is needed for the specified operation. If text is in a field, it is disabled too, although it is still available if you switch to a different operation.



Match Mode

By default, you’ll start in Match mode. Make sure you have a regular expression entered. Try something easy like:

[aeiou]

Then, in the sample text field, type some sample text, for example:

This is a test.

In the Result field (which is read only) you’ll see your sample text, but you’ll also see what looks like somebody went through with a yellow highlighter. The highlights signify areas that your regular expression found a match. In this case, you would see any vowels are highlighted.

It is that easy!

The following picture shows the Match Mode in the Test Tab:



Replace Mode

Replace mode requires one additional piece of information, that of the replacement text. You’ll notice that as you choose the Replace radio button, the Replacement Text field will become enabled. Try typing some text in there. For this example, you can enter a single character, like an asterisk (“*”).

You’ll notice in this mode that there is no yellow highlighting, but instead the replacement text appears in all the locations where there were previously vowels.
 

The following picture shows the Replace Mode in the Test Tab:



Split Mode

The Split mode does not require replacement text, so that field is disabled. Instead, the big difference in Split mode is that you’ll see separate replacement sections, each denoted by an array.

The following picture shows the Replace Mode in the Test Tab: