LWN.net Logo

Advertisement

E-Commerce & credit card processing - the Open Source way!

Advertise here

Kodos: A Python Regular Expressions Tool

Kodos, apparently named after one of the slobbering alien character on the cartoon "The Simpsons", is a handy GUI tool for working with regular expressions in Python.

In the About Kodos page, author Phil Schwartz says: "I have always found the development cycle of python regular expressions to be tedious and time consuming and I searched for a tool to aid in this area. When I could not locate a desirable tool I began to create my own. As I added features, I thought it would be useful to other developers as well and created the Kodos Project page on Sourceforge."

[Kodos] The Kodos screenshots page shows the utility in action. Kodos' display is divided into three windows. The top window is used for entering the regular expression, the middle window is for entering test strings, and the bottom window shows the resulting matched strings in several formats. The bottom screen also features a handy Sample Code mode that generates several examples of working Python code.

There are a number of radio buttons for selecting regexp flags such as Ignore Case. A handy regexp reference window can be popped up to show the available regexp syntax characters.

It is apparently possible to get Kodos to run under RedHat 7.3 and Debian Woody, but your author ran into several cases of dependency hell on both systems. Luckily, I had a spare machine, and wanted to play with a variant of RedHat 8.0 known as KRUD Linux. Kodos 1.0.2 installed without a hitch on that environment.

Version 1.1 of Kodos was announced this week. Some of the new features include the addition of pausing and unpausing the processing of regexps, an editing timeout, an import file option, new preferences, code cleanup, and bug fixes.

Kodos is definitly a utility that will be a welcome addition to a Python programmer's tool kit. It give an immediate productivity boost to those who use Python regular expressions. The software is availabe for download here. Additional information can be found in the online Kodos Documentation.


(Log in to post comments)

Kodos: A Python Regular Expressions Tool

Posted Apr 17, 2003 3:13 UTC (Thu) by komarek (guest, #7295) [Link]

Isn't the Python regex syntax pretty close to the POSIX syntax available in C regex libraries under unix-ish systems? If so, I'd think that Kodos might be handy outside of Python, too.

-Paul Komarek

Kodos: A Python Regular Expressions Tool

Posted Apr 17, 2003 16:26 UTC (Thu) by piman (subscriber, #8957) [Link]

Python's regular expressions are much closer to Perl (and Ruby, and anything else with PCREs) than to POSIX.

Test Cases

Posted Apr 17, 2003 23:58 UTC (Thu) by AnswerGuy (subscriber, #1256) [Link]


I haven't tried this tool, but from the description their is a box for
entering test strings. That's find and dandy for interactive use but
I've found that you really want to have your regexp test cases stored
in a file (preferably a largish sample of the typical text that this
program is supposed to encounter.

Way back in my awk programming days I found it handy to write small
stubs of awk code that simply desplayed regexp matches from my test
case file. Actually having two test case files make sense --- one
that contains nothing but cases that should match and the other such
that there should be NO matches.

So, perhaps we should send the author a patch that implements these
features --- in the form of two buttons:

Test Cases: [Run] [Configure]

Configure would allow one to point to one or two text files (for
"match all" and "match none" (and optionally allow cases to be added
to or removed from either of them).

Run would just run the current regexp against all the test cases
and show any failures.

This feature would promote one of the best practices from eXtreme
Programming --- create test suites and harnesses before coding.

JimD

Copyright © 2003, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds