TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Pythex: a Python regular expression editor

97 pointsby teoruizabout 14 years ago

15 comments

_deliriumabout 14 years ago
I sometimes use <a href="http://regexio.com/" rel="nofollow">http://regexio.com/</a> to debug in the reverse direction: given a regex, generate a bunch of strings it matches, which sometimes quickly lets me see "wtf, why would it match strings like <i>that</i> one?"<p>That's something it'd be cool to see explored more; when I'm writing a regex, I usually have in mind a space of strings it's supposed to match, so a very useful debugging tool would be some way of showing me what that space is, so I can see if it's the same as the one in my head. I can't think of any cool infoviz tricks offhand that would be more useful than just a list of matching strings, but there must be something.
评论 #2469100 未加载
epennabout 14 years ago
The interface is very clean, simple, and to the point. One suggestion though: It very quickly gives an "Invalid regular expression" error while I'm still typing. From the perspective of the regex parser that is certainly a correct assessment. However from a user's perspective, what's entered is simply incomplete. Although I like the instant evaluation/validation of the expression, it might be a good idea to increase the interval between when the last key is pressed and when the evaluation begins. The need to read the error message along with the textbox turning red while the regex is only incomplete causes an unneeded break in user interaction.<p>That aside, nice work! I'm sure I'll be using it. :)
gojomoabout 14 years ago
My entry into this category of tools uses a (hidden) Java applet to avoid the need to send any data to a server (and the limits of the native JS regexp functionality). See:<p><a href="http://regex.powertoy.org" rel="nofollow">http://regex.powertoy.org</a><p>It also has an animate mode, which is most interesting on regexes with heavy backtracking. For example, animations of the famous 'prime-digits-count' regex, succeeding (composite) or failing (prime):<p>49: <a href="http://regex.powertoy.org/?pat=/^1%3F%24|^%2811+%3F%29\1+%24/&#38;syn=perlSyntax&#38;anim=1&#38;rep=&#38;in=1111111111111111111111111111111111111111111111111" rel="nofollow">http://regex.powertoy.org/?pat=/^1%3F%24|^%2811+%3F%29\1+%24...</a><p>47: <a href="http://regex.powertoy.org/?pat=/^1%3F%24|^%2811+%3F%29\1+%24/&#38;syn=perlSyntax&#38;anim=1&#38;rep=&#38;in=11111111111111111111111111111111111111111111111" rel="nofollow">http://regex.powertoy.org/?pat=/^1%3F%24|^%2811+%3F%29\1+%24...</a>
cypherpunks01about 14 years ago
Great! It's very simple and useful.<p>One little thing, the regular expression input is in an html form, so if you hit enter (in most browsers) it POSTs to a blank page and you can lose your work. You can make the form onsubmit="return false;" if you never want it to submit.
sedachvabout 14 years ago
There's <a href="http://weitz.de/regex-coach/" rel="nofollow">http://weitz.de/regex-coach/</a> , which you don't need an Internet connection to use.
评论 #2467496 未加载
larrikabout 14 years ago
Actually saw this as well today:<p><a href="http://txt2re.com" rel="nofollow">http://txt2re.com</a><p>Although I like yours better for what I'm doing.<p>Edit: was originally posted here (with a bad title and subsequently ignored):<p><a href="http://news.ycombinator.com/item?id=2449640" rel="nofollow">http://news.ycombinator.com/item?id=2449640</a>
mgrouchyabout 14 years ago
Must be getting killed, times out for me.<p>Too bad, because I had wanted to see a python specific version of <a href="http://rubular.com" rel="nofollow">http://rubular.com</a>
评论 #2466989 未加载
评论 #2466869 未加载
Tychoabout 14 years ago
Superb... but I have two major issues (aka <i>please</i> add these features:<p>1. Can you add an option to return the code for the actual Python function? Then we can just copy&#38;paste right into our source<p>2. A cheat sheet like on rubular. Make it a pull-up menu from the bottom or something, so it doesn't clutter your nice layout too much
roryokaneabout 14 years ago
I think it needs an option to match all results, not just the first. This would let me test a regex against many strings at once. You could allow this by adding, below the bubbles, two radio buttons labeled "search" and "findall" - I those are the corresponding Python methods, as far as I can tell.
chromejs10about 14 years ago
Awesome! Wish I had this a while ago during school. This is a good learning tool too since you can see how each addition affects the matching. I like Tycho's idea about have a little cheat sheet. That would add to the "learning tool" idea substantially.
adamtjabout 14 years ago
<a href="http://kodos.sourceforge.net/" rel="nofollow">http://kodos.sourceforge.net/</a>
评论 #2467088 未加载
clsungabout 14 years ago
I prefer <a href="http://rubular.com/" rel="nofollow">http://rubular.com/</a>, not because the language, but for '504 Gateway Time-out' when I connect to pythex.org right now. And I always connect to rubular.com successfully.
alissonabout 14 years ago
It would be nice if named groups were supported. Something like: (?P&#60;protocol&#62;https) Being captured like: protocol: https instead of 1: https<p>Nice work!! :)
评论 #2467050 未加载
makmanalpabout 14 years ago
This is also good: <a href="http://www.cuneytyilmaz.com/prog/jrx/" rel="nofollow">http://www.cuneytyilmaz.com/prog/jrx/</a>
zquestzabout 14 years ago
Rubular is still nicer, part of the charm was the small cheat sheet at the bottom of the page.