Recently I was asked to look at a brand- new online regex tester, regviz.org, developed as a collaboration of VISUS, University of Stuttgart and University of Trier. Though there are a lot of regex online testers on the market today, and many of them are quite good, let’s look at what is special about regviz.org and what it lacks.
First of all let’s highlight some features that make this online regex tester so special.
Single-purpose edit controls
Unlike other similar tools, this one doesn’t use text areas or input text fields for entering regular expression and text for testing it. Instead the developers created their own editor that allows adding a special marking to the text. I think this is the most outstanding feature of this tool.
For example, this editor is able to highlight special characters and numbered groups right in the place where you type in your regular expression:
When you hover some element of your regex you get a tootlip with an explanation (but so far these explanations are not as rich as they could be):
In the same manner, the result box also has some specialized marking. You can see which text matches, which text doesn’t match and where the numbered groups are:
Along with the mentioned advantages, these custom edit boxes have their minor drawbacks as well. For example, when you select text, you may see some strange behavior (at least in Google Chrome on my Mac):
The RegViz tool allows you to specify some portions of the text to use as testing samples for your regular expression. This allows you to quickly evaluate the successfulness of your regex.
For example, if you are building an email testing regex, you can specify several email addresses as tests and see how your regex succeeds with them:
From this picture you can see that my regular expression successfully passed two tests out of three and has one possible additional match.
Though many online regex testers allow sharing the regexes and results, this one puts all parameters right into the URL instead of creating a session and giving you a short permalink. For example, here is an example of a URL for a short regular expression and its source text:
Though this approach gives you the ability to build your own URLs to regviz.org, it has some obvious limitations related to maximum URL length and the necessity of using of link shorteners for sharing on Twitter or somewhere else.
Shortcomings and limitations
Of course this tool is not absolutely perfect, and for the sake of fairness I need to write about some of its shortcomings and limitations.
RegViz works with JavaScrips regexes only. This is a serious limitation. It’s not a secret that different languages have slightly different regex implementations. For example, I constantly work with C#, PHP (pcre) and Python; for this reason I’d like to test regex for these engines as well. That’s why I would prefer regex101.com in this regard.
Not Responsive Enough
Though regviz.org has a nice and simple interface, the layout of its page doesn’t match narrow screens in a proper way. If you try to use it on a mobile device, for example, you will find that the right panel (with a quick help) overlays the main working area. This behavior is not acceptable for a modern online tool.
Doesn’t apply changes immediately
Unlike some other tools of this kind, RegViz has a certain lag-time for applying changes. When you make a change in the regular expression, you have to wait a couple of seconds before your change is applied. I don’t know why the developers decided to do it this way, but this may cause some confusion on the end user side (at least it did for me).