Regex Tool is a web based application for testing your PHP regular expressions with fast to use, yet powerful interface. Regex tool was developed especially for PHP developers, who often work with regular expression, but without readily available tools for testing them. Sometimes debugging regular expressions can be slow, because it might be hard to tell, for example, what the expression is actually matching.
For quick guide on how to use, just enter the subject that you wish to use in the larger text area and the pattern to the top area and hit the "Match / Split / Replace" button and you will get the resulting matches. Below you will find more detailed information about the Regex Tool and available features.
The Regex Tool has support for 2 different regex engines. PCRE and POSIX, both of which are integrated into PHP. Since POSIX does not have support for any kind of pattern modifiers, an NC (no case) version is also available, which makes the regular expressions case insensitive (using PHP's eregi functions).
Note that while both of these are supported, some features are only available on PCRE. These features are:
One of the main features of the Regex Tool is ability to highlight strings from original subject. This makes it easy to determine, what exactly was matched in the subject. To highlight the match, simply click on the number on the position column of the match. This will draw a black background color for the highlighted part in the subject and color the text white to make it easily noticable. If the matched string is empty, then extra "#" will be temporarily inserted in the location of the match.
Note that highlighting is not available when using POSIX regex engine. Also, if the full subject is not displayed, then the subject will of course be only highlighted up to the displayed part.
While any data you send through the form takes priority, all the data is also stored in a session. This is handy, because it allows you to easily transfer the session from one browser to another (in case you need to) or give the url to the session to someone else. The url to the session is available in the bottom of the form.
Note that it is highly advisable to either lock the session or copy it before giving it to others. If you do not copy it, you and someone else may be using the same session, which will interfere with both of your working.
The following buttons are available in the session management:
Note that all sessions will expire eventually, and if you leave your browser open for too long, the session might expire while you are still using the Regex Tool, which may cause you to lose your data. Note that pretty much all data, except the subject is resubmitted on every page load. Thus, by using the "Keep subject" option, expiration of session should cause you to lose data.
While there is nothing too special about editing the subject, there are, however few special features that you can take advantage of.
You may also use the form to upload a file to use as a subject. If you use the file upload, the subject is read from the file instead of the form. However, after that you may edit the subject normally, as if you had entered it through the form.
There are also few addinational options in the options panel, that can help you and provide extra features. Note that all the settings default to most commonly used settings, so most of the times you don't really need to change them at all.
Sometimes it may be hard to enter the exact lineending you wish in the form input. The translation setting allows you to translate all the line endings to what you want. Do note however that this is done prior to parsing whitespace, which means that if you use this to remove whitespace, all that is left is the whitespace you manually entered.
In addition to the other choices, you may also choose here the engine you wish to use. The standard PHP regex engines are both available. The NC option indicates that it is case insensitive matching (as POSIX does not have pattern modifiers).
Additionally, there is a "Stress Test" setting, which allows you to run the same pattern multiple times over the matches. This is useful, when you need to test how effective some patterns are. The time it took to run the test is available in the Information box.