Regular Expression Tester - User Guide

Features

Testing a Regular Expression

The process is very simple:

Moving Through Matches

If you got a lot of matches, you may want to navigate through them. This can be done by using the arrows in the views tool bar. Choose "Next Match" to move the selection to the next match. Choose "Previous Match" to go back to the previous match found. The result area will also show the match's relevant entries.

Another way to navigate to a certain match is to put the cursor inside a marked match or draw a selection on it. Then right click to see the context menu and choose Go To Match. Now the result area will show you the result data belonging to this particular match.

LiveEval

LiveEval is a comfortable way to continiously test your regex. If it is activated, everytime you change something in your regex the program re-evaluates it and shows its results. This also works if you do not touch the regex, but change the search text or choose any of the pattern flags. You always get a live feedback if your changes led to the right result or not.

You can also use the preferences dialog (Window > Preferences) to change this feature's behavior. Please refer to Preferences for details.

Pattern Flags

If you open the regex' context menu by right clicking on it, you can choose Pattern Flags to see the flags which can be applied.

Menu ItemJava Pattern FlagDescription
Canonical EquivalencePattern.CANON_EQWhen this flag is specified then two characters will be considered to match if, and only if, their full canonical decompositions match.
Case InsensitivePattern.CASE_INSENSITIVEEnables case-insensitive matching.
CommentsPattern.COMMENTSPermits whitespace and comments in pattern.
Dotall ModePattern.DOTALLIn dotall mode, the expression . matches any character, including a line terminator.
Multiline ModePattern.MULTILINEIn multiline mode the expressions ^ and $ match just after or just before, respectively, a line terminator or the end of the input sequence.
Unicode CasePattern.UNICODE_CASEEnables Unicode-aware case folding.
Unix LinesPattern.UNIX_LINESIn this mode, only the '\n' line terminator is recognized in the behavior of ., ^, and $.

If you choose Pattern Flags > Deactivate All all selected flags will be removed. You can also use the preferences dialog (Window > Preferences) to select a number of default flags. Please refer to Preferences for details.

Code Generation

If you want to use your regular expression as a literal String in your Java code, you might find yourself in trouble. Your trouble maker #1 here is the backslash ("\"). In Strings backslashes are used to escape certain kind of characters, e.g \n for a new line or \t for a tab. Java only allows certain characters to be followed by a backslash. So if you use any backslahes in your regular expression you will either get a compile error because Java does not accept the following character or your regex will be mis-interpreted. What you have to do is to escape every backslash with another backslash so Java can safely ignore them, e.g. /(x/) becomes //(x//).

To help you with this task, right click on your regular expression and choose Copy As String Literal. Now you can paste the escaped regex anywhere in your code.

If you would like additional help with code generation, you can also choose Copy As Java Declaration from the regex's context menu. This will escape the regex as described above and create the neccessary Java code. For example if your regex is /(x/) and you chose the pattern flag Dotall Mode you will get Pattern.compile("//(x//)",Pattern.DOTALL); which you can paste anywhere you like.

Preferences

You can change preferences by choosing Window > Preferences and selecting RegEx Tester. You can specify Default Pattern Flags which will be set every time the RegEx Tester plugin starts up. This has no effect on the currently set pattern flags. For the flag's detailed description please refer to Pattern Flags

In the Live Eval section of the preferences dialog you can change a number of settings related to the live evaluation of regular expressions (LiveEval).

Currently there are 3 modes for Live Eval:

Use Live Eval determines if LiveEval should be turned on or off. If you check this box, LiveEval will be activated immediatly and per default (next time you start the plugin).