[TxMt] a regexp test script (link)

David Lee david at davelee.com.au
Tue Apr 5 04:19:28 UTC 2005


Nice one Eric.

I'll have a look at my script when I get home & work out if it's worth
cleaning up & submitting to svn. I didn't get any such errors but I'm stuck
on windows here :( so textmate will have to wait till later.

Cheers

D

-----Original Message-----
From: Eric Hsu [mailto:erichsu at math.sfsu.edu] 
Sent: Tuesday, 5 April 2005 7:32 AM
To: TM Users
Subject: Re: [TxMt] a regexp test script (link)

I've written an alternative version of the regular expression checker. It
relies heavily on a script I found on the web by Aristotle at perlmonks.org
(cited in the code).

I've checked it into the svn repository. There's also a version of the Ruby
script that produces a tooltip (though I can't get that to work on my
computer yet). They live at
http://macromates.com/svn/Bundles/trunk/RegularExpressions.tmbundle/

The way this alternative works is you copy the regexp to the clipboard, then
highlight the text you want to check. Then it produces HTML output which
color codes each subcapture.

There might be a nicer way to grab the regexp, like maybe using Cocoadialog,
but I just wanted to get this out there.


best wishes, Eric

ps. Here's what you get with the sample file David Lee posted:

CLIPBOARD
(http|https|ftp):\/\/(([-_a-zA-Z1-9]+)\.)+([-_a-zA-Z1-9]{2,3})

INPUT
http://www.google.com
https://www.netbank.com.au
ftp://mafia.ru
www.clickstart.com
boozehound
gary sweeney
http://www.amazon.com/
http://www.amazon.com/exec/obidos/subst/home/home.html/002-0270779-6984007


OUTPUT.
<html><head></head><body>
<h3>Results for 
/(http|https|ftp):\/\/(([-_a-zA-Z1-9]+)\.)+([-_a-zA-Z1-9]{2,3})/</h3><tt>
<b><font color="Red"></font></b><b><font color="Dark 
Blue">http</font></b><b><font color="Red">://www.</font></b><b><font 
color="Dark Purple">google.</font></b><b><font 
color="Red"></font></b><b><font 
color="Brown">google</font></b><b><font 
color="Red">.</font></b><b><font 
color="Burgundy">com</font></b><b><font color="Red"></font></b>
<br/><b><font color="Red"></font></b><b><font color="Dark 
Blue">https</font></b><b><font 
color="Red">://www.netbank.</font></b><b><font color="Dark 
Purple">com.</font></b><b><font color="Red"></font></b><b><font 
color="Brown">com</font></b><b><font color="Red">.</font></b><b><font 
color="Burgundy">au</font></b><b><font color="Red"></font></b>
<br/><b><font color="Red"></font></b><b><font color="Dark 
Blue">ftp</font></b><b><font color="Red">://</font></b><b><font 
color="Dark Purple">mafia.</font></b><b><font 
color="Red"></font></b><b><font 
color="Brown">mafia</font></b><b><font 
color="Red">.</font></b><b><font 
color="Burgundy">ru</font></b><b><font color="Red"></font></b>
<br/>www.clickstart.com
<br/>boozehound
<br/>gary sweeney
<br/><b><font color="Red"></font></b><b><font color="Dark 
Blue">http</font></b><b><font color="Red">://www.</font></b><b><font 
color="Dark Purple">amazon.</font></b><b><font 
color="Red"></font></b><b><font 
color="Brown">amazon</font></b><b><font 
color="Red">.</font></b><b><font 
color="Burgundy">com</font></b><b><font color="Red"></font></b>/
<br/><b><font color="Red"></font></b><b><font color="Dark 
Blue">http</font></b><b><font color="Red">://www.</font></b><b><font 
color="Dark Purple">amazon.</font></b><b><font 
color="Red">com/exec/obidos/subst/home/home.html/002-0270779-6</font></b><b>
<font 
color="Brown">amazon</font></b><b><font 
color="Red">.</font></b><b><font 
color="Burgundy">com</font></b><b><font 
color="Red"></font></b>/exec/obidos/subst/home/home.html/002-0270779-6984007
<br/></tt></body></html>

-- 
Eric Hsu, Assistant Professor of Mathematics
San Francisco State University
erichsu at math.sfsu.edu
http://math.sfsu.edu/hsu
______________________________________________________________________
For new threads USE THIS: textmate at lists.macromates.com
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate





More information about the textmate mailing list