retest, test Python regular expressions in a webbrowser

what is it

A simple Server which enables tests of Python regular expressions ( re module) in a webbrowser. Uses SimpleHTTPServer and AJAX .

retest local browser application

retest is available to be run locally as a browser application.

retest screenshot:
screenshot thumbnail

You only need: Python , a modern webbrowser like Firefox, IE (from 5.5), Safari or Opera (from 8) which handles XMLHttpRequest .

license

Creative Commons License
This work is licensed under a Creative Commons License .

download

Tested with Python 2.5, Firefox 1.06/2.0.0.1, Internet Explorer 6/7 and Opera 8.02/8.50 on Windows XP only. Seems to work best with Firefox and Opera.

Paul Bissex reported retest working on OS X 10.4.3 (Python 2.4.1) in Safari, Camino, Opera, and Firefox. Bryon Gill reports retest working fine on Fedora Core 4, Python 2.4.1, Mozilla 1.7.10. James Thiele reports retest v0.5.1 works on OS X 10.3.9 Python 2.3. Erik Knowles reports retest working on Mandriva 10.1.

usage

Start the server with >python reserver.py and open http://localhost:8087/ in your webbrowser (if the browser is not started automatically. You might want to adjust the PORT used in reserver.py.

The usage of the application itself should be self explanatory, take a look in the Python documentation for the re module .

Full keyboard usage is enabled. You may have to adjust the shortcuts to your browser or OS environment (e.g. on Windows ALT-T [in Firefox SHIFT-ALT-T ] puts the focus in the " T ext" field.). See the titles on the specific items for the keyboard shortcuts which are normally the underlined characters or, in the case of the size adjustment buttons, the characters 1-6 .

change history

v0.7 090318
retest with the alias name "re-try" is available as an online application on GAE.
v0.6.1 061224
merely optical changes swapping regex and text area and a bit of cleanup
v0.6 060211
  • lots of code improvements by James Thiele (thanks a lot!)
  • added exit button (together with server code by James Thiele)
v0.5.2 060202
convienience enhancement: added automatic opening of application webpage in the systems default browser (using the webbrowser module)
v0.5.1 050923
removed absolute URL from retest.html. If you want to use a different port than the default (8087) now you need to adjust it in reserver.py only.
v0.5 050911
  • added re.match and re.search , both show groups and named groups if any found
  • added accesskeys for all functionalities
v0.4 050906
  • bugfix for re.split : used wrong parameters until now, should work as expected now
  • bugfix for IE: removed return from callback function which also makes IE behave and working
  • added addEvent function to http.js
  • changed event types
v0.3.1 050904
  • calling the server with no path opens "retest.html" by default
  • bugfix for Opera 8 in http.js
v0.3 050828
  • redid UI completely: accesskeys, proper tabindex, buttons to expand or shrink text, re or result areas
  • result output displayed in <textarea> instead of <div> again due to HTML entity issues
  • fix of unicode problems on the server side
v0.2 050827
  • added radio selector for method of re, currently re.findall and re.split only
  • result output displayed as returnd from re directly
  • result output displayed in <div> instead of <textarea>
  • sent re and text are escaped from javascript now
v0.1 050824
initial release