Technical Overview
↵ back to regex powertoy
Regex Powertoy regex.powertoy.org

How it Works

Basic Matching

Matching is done by a hidden Java applet, using the standard java.util.regex package. No information is sent over the net after the page loads: the applet only transmits information to/from the page itself, using the Java Plug-in's suport for Javascript-to-Java Communication (AKA "LiveConnect"). Thus no special permisssions are necessary.

Most but not all Perl regular expression constructs are supported by the Java regex engine; see the Javadoc for java.util.regex.Pattern for full details. (See the section "Comparison to Perl 5")

Animation

The regex engine is passed a special wrapped CharSequence that reports -- and optionally stalls -- the engine at each of its invocations of #charAt(), allowing the animation effect.

Highlighting

CSS + Javascript sure is nice! The Prototype.js library is used to make DOM-juggling a little easier.

Tested Configurations

Originally tested in Firefox 1.0.7/1.5 with Java 5.0 ("1.5"). Now also tested with Firefox 2 and 3 with Java 6 ("1.6"). Mostly works in IE6, though boxes are missized and manual-step animation doesn't refresh properly. May work with Java 2 ("1.4.2").

Source / Downloads

All HTML/JS/CSS/Java code GPL licensed, available via Sourceforge CVS. You can run this entirely locally from your desktop, if desired. (But why? You might fall behind the latest bells & whistles!)

If you reuse Regex Powertoy code in your own projects, a link back to regex.powertoy.org would be appreciated.

Credits

Regex Powertoy was created by Gordon Mohr. Please visit my blog to leave questions, comments, and suggestions.

Copyright 2005-2008 Gordon Mohr.