<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>我爱正则表达式 &#187; regexbuddy</title>
	<atom:link href="http://iregex.org/blog/tag/regexbuddy/feed" rel="self" type="application/rss+xml" />
	<link>http://iregex.org</link>
	<description>原创、翻译、转载关于正则表达式的文章</description>
	<lastBuildDate>Fri, 30 Mar 2012 12:50:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/><atom:link rel="hub" href="http://www.feedsky.com/api/RPC2"/><atom:link rel="hub" href="http://blogsearch.google.com/ping/RPC2"/><atom:link rel="hub" href="http://blog.yodao.com/ping/RPC2"/><atom:link rel="hub" href="http://www.feedsky.com/api/RPC2"/><atom:link rel="hub" href="http://www.xianguo.com/xmlrpc/ping.php"/><atom:link rel="hub" href="http://www.zhuaxia.com/rpc/server.php"/><atom:link rel="hub" href="http://rpc.technorati.com/rpc/ping"/><atom:link rel="hub" href="http://rpc.pingomatic.com/"/>		<item>
		<title>打造自己的正则表达式助手程序</title>
		<link>http://iregex.org/blog/diy-regexbuddy.html</link>
		<comments>http://iregex.org/blog/diy-regexbuddy.html#comments</comments>
		<pubDate>Wed, 12 May 2010 05:32:37 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[应用]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[regexbuddy]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=115</guid>
		<description><![CDATA[其实RegexBuddy挺好用的，我一直用它。它的用法、好处，可以写好多文字，本站也做过介绍；不过，也有理由不用它，同时这也是撰写本文的一个原因。我动了动脑筋，花了一点时间，已经做出... ]]></description>
			<content:encoded><![CDATA[<p>其实RegexBuddy挺好用的，我一直用它。它的用法、好处，可以写好多文字，本站也做过介绍；不过，也有理由不用它，同时这也是撰写本文的一个原因。我动了动脑筋，花了一点时间，已经做出雏形。现在将思路公布在这里，与各位交流一下。</p>
<p><span id="more-115"></span></p>
<h2 style="background-color:#99CC00; border:1px solid #666666;color:#000000;font-size:21px;line-height:35px;padding-top:3px;text-indent:6px;">缘由</h2>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;">为什么不用RegexBuddy了</h3>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<ul>
<li>它是收费软件，价格不算便宜。$39.95。Google一下，或有惊喜。</li>
<li>它只能用于Windows平台。虽然在ubuntu下，我会额外安装wine，仅仅是为了驱动RegexBuddy。</li>
<li>Mac下无法使用RegexBuddy。近来我开始使用Mac环境了，不想再为windows软件单独运行环境了。regexbuddy似乎要失之交臂了。搜索了一下，<a href="http://search.macupdate.com/search.php?keywords=regex&#038;os=mac" title="我爱正则表达式|打造自己的正则表达式助手程序">这里</a>，<a href="http://www.apple.com/search/?q=regex&#038;sec=downloads" title="我爱正则表达式|打造自己的正则表达式助手程序">这里</a>，找到的软件聊聊无几，性能也乏善可陈：大多仅支持JavaScript这样比较朴素的正则，缺乏多语言、多选项的支持。&#8211;RegexBuddy出色的表现，已经将我对正则辅助软件的期望值训练得极为挑剔，一般软件难以落入老夫的法眼了，呵呵。</li>
</ul>
<p>没有现成的解决方案，我就考虑，如何自己DIY一个了。</p>
</blockquote>
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;">我理想中的正则辅助软件</h3>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<ol>
<li>像RegexBuddy一样，支持以下属性：</li>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<ol>
<li>支持多语言正则。至少要支持Perl, Python, PHP, JavaScript吧。.Net的用得不多（只在回答别人问题时用过，不算），可以无视；</li>
<li>支持匹配、替换、分割(split)；</li>
<li>支持生成代码片段；这一点很重要。我平常不会死背硬记一些电脑可以代劳的冬冬，除非经常用&#8211;经常用的，慢慢也就变成肌肉记忆了。</li>
</ol>
</blockquote>
<li>除此之外，它最好还能：</li>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<ol>
<li>兼容于各种常见平台。我指的是，Win/Lin/Mac。</li>
<li>对于语言的支持要原生。说实话，我怀疑RegexBuddy还在用Perl5.8风格的正则。5.10中的许多新奇好用的特性，还没有在RegexBuddy中得到支持。究其原因，RegexBuddy的作者大概是自行从头构建的Perl等正则引擎，在细节、版本上，与最新版有所差异。说到语言，想起余晟老师的一点意见，就是思考正则问题时，先不要考虑是什么语言、版本的正则，心中要有统一的语法。我同意余老师的观点，但是也觉得，在了解了貌似通用的正则语法基础之后，应该比较清晰地了解自己最常用的正则语言的语法细节，以及与其它语言的差异，以避免似是而非。跑题，打住。</li>
<li>开源，正版，免费。我们向其他人介绍正则，总得有一款可以拿得出手的工具吧？免费这条倒是不苛求，话说好软件还是应该有所回报的。</li>
</ol>
</blockquote>
</ol>
<p>问题是，这么好的软件，到那里去找呢？找不到的话，自己想从头实现，该如何动手呢？ </p>
</blockquote>
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;">我的思路历程</h3>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<ul>
<li>使用Objective-C来实现。不过，这想法没多久就像萝莉一样被推倒了。Obj-C固然是要学的，但我等不及了。RegexBuddy这类的软件我是天天都在用。这个目标似乎比上一条还要临渴掘井。为mac平台开发了，代码至少还要为win/lin单独编译吧？再者，如果用了Obj-C，正则引擎怎么办？从头实现？xiaofei说，要实现一个好用的正则引擎，要一个优秀的团队半年的时间。当然，Obj-C也可以调用现成的模块，这也引出了我现在的思路。</li>
<li>做成网页程序，前端接收用户输入，后端使用CGI调用服务器上的原生正则引擎（perl、python），匹配、替换后展现在前端。它最大的好处是，语言百分百原生，Native；只要网络在，打开浏览器就能用；即使没有网络，本机localhost也可用，而且更快。JavaScript/PHP就不必劳驾CGI了，原汤化原食就可以。</li>
</ul>
<p>                             话说我已经选择了第二套方案，于是就着手实现。
                        </p></blockquote>
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;">目前的进度</h3>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<ul>
<li>已经使用HTML+jQuery画出了简单的界面，实现了perl 5.10版的CGI程序，能够进行匹配、替换、分割（Split)。</li>
<li>未实现的功能：代码Snippets自动生成；其它语言版本的实现。</li>
<li>对于我自己来说，基本上已经可以使用了。我现在就正在 eat my own dog food，一边用它，一边完善它。不过要想发布出来供大家使用，还需要旷日持久的功能完善、界面美化。</li>
<li>截图见文章末尾。<br/>
</ul>
</blockquote>
</blockquote>
<h2 style="background-color:#99CC00; border:1px solid #666666;color:#000000;font-size:21px;line-height:35px;padding-top:3px;text-indent:6px;">Perl CGI 代码以及简要说明</h2>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;">代码</h3>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<div class="codecolorer-container perl mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br /></div></td><td><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span><br />
<br />
<span style="color: #000000; font-weight: bold;">use</span> CGI<span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$counter</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">sub</span> cl <span style="color: #009900;">&#123;</span> <br />
&nbsp; &nbsp; <span style="color: #0000ff;">$counter</span><span style="color: #339933;">*=-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #ff0000;">&quot;#ff0&quot;</span> <span style="color: #b1b100;">if</span> <span style="color: #0000ff;">$counter</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #ff0000;">&quot;#0ff&quot;</span> <span style="color: #b1b100;">if</span> <span style="color: #0000ff;">$counter</span><span style="color: #339933;">==-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">sub</span> h_color<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span><span style="color: #000066;">shift</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$counter</span><span style="color: #339933;">*=-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$color</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$counter</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #ff0000;">&quot;#ff0&quot;</span> <span style="color: #339933;">:</span> <span style="color: #ff0000;">&quot;#0ff&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #ff0000;">&quot;&lt;span style='background-color:$color'&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$a</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;&lt;/span&gt;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$q</span><span style="color: #339933;">=</span>CGI<span style="color: #339933;">-&gt;</span><span style="color: #000000; font-weight: bold;">new</span><span style="color: #339933;">;</span><br />
<span style="color: #000066;">die</span> <span style="color: #ff0000;">&quot;$!&quot;</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$q</span><span style="color: #339933;">;</span><br />
<span style="color: #000066;">print</span> <span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">header</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>type<span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$regex</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;regex&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">#quit immediatly if no $regex input</span><br />
<span style="color: #000066;">die</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$regex</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$text</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$mode</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;mode&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$x</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;space&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$action</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;action&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #0000ff;">$regex</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/\s+//g</span> <span style="color: #b1b100;">if</span> <span style="color: #0000ff;">$x</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$action</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">&quot;match&quot;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$code</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">'$text =~ s@$regex'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">'@&amp;h_color($&amp;)'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">'@eg'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$mode</span><span style="color: #339933;">.</span><span style="color: #ff0000;">';'</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <span style="color: #000066;">eval</span> <span style="color: #0000ff;">$code</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$text</span> <span style="color: #339933;">=~</span> <span style="color: #000066;">s</span><span style="color: #666666; font-style: italic;">#\n#&lt;br /&gt;#g;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">print</span> <span style="color: #0000ff;">$text</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$@</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$action</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">&quot;replace&quot;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span> <br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$code</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$replace</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">param</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;replace&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\$</span>text =~ s:<span style="color: #000099; font-weight: bold;">\$</span>regex:$replace:g;&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066;">eval</span> <span style="color: #ff0000;">&quot;$code&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$text</span> <span style="color: #339933;">=~</span> <span style="color: #000066;">s</span><span style="color: #666666; font-style: italic;">#\n#&lt;br/&gt;#g;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;&lt;pre&gt;$text&lt;/pre&gt;&quot;</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$@</span><span style="color: #339933;">;</span> <br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$action</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">&quot;split&quot;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#@result=split(m@$regex@mode, $text);</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$code</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">'@result=split(m@$regex@'</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">$mode</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">', $text);'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">'@result=grep /\S/, @result;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">'my $count=@result;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">'print &quot;&lt;font color=\&quot;#ff008c\&quot;&gt;$count&lt;/font&gt; record(s) returned:&quot;;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">'print &quot;&lt;ol&gt;&quot;;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">'print &quot;&lt;li&gt;&quot;.&amp;h_color($_).&quot;&lt;/li&gt;&quot; foreach (@result);'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$code</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">'print &quot;&lt;/ol&quot;;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">eval</span> <span style="color: #0000ff;">$code</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</blockquote>
<p>代码…还算简洁。主要就是接收并简单处理一下各个参数，然后按照不同的动作要求（match/replace/splie）进行相应的动态代码生成，然后eval执行结果，返回输出。在match/split中，还插入了代码高亮的小功能。基于perl代码的高效紧凑，实现起来倒也不至于冗长。感谢<a href="http://twitter.com/cnhacktnt">cnhacktnt</a>的协助。</p>
</blockquote>
<h2 style="background-color:#99CC00; border:1px solid #666666;color:#000000;font-size:21px;line-height:35px;padding-top:3px;text-indent:6px;">截图</h2>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<ul>
<li><a href="http://iregex.org/blog/diy-regexbuddy.html" target="_blank" title="我爱正则表达式|打造自己的正则表达式助手程序"><img src="http://i293.photobucket.com/albums/mm60/zhasm/match.png" border="0" alt="Photobucket"></a></li>
<li><a href="http://iregex.org/blog/diy-regexbuddy.html" target="_blank" title="我爱正则表达式|打造自己的正则表达式助手程序"><img src="http://i293.photobucket.com/albums/mm60/zhasm/match_cn.png" border="0" alt="Photobucket"></a></li>
<li><a href="http://iregex.org/blog/diy-regexbuddy.html" target="_blank" title="我爱正则表达式|打造自己的正则表达式助手程序"><img src="http://i293.photobucket.com/albums/mm60/zhasm/replace.png" border="0" alt="Photobucket"></a></li>
<li><a href="http://iregex.org/blog/diy-regexbuddy.html" target="_blank" title="我爱正则表达式|打造自己的正则表达式助手程序"><img src="http://i293.photobucket.com/albums/mm60/zhasm/split_cn.png" border="0" alt="Photobucket"></a></li>
</ul>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/diy-regexbuddy.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>搬家完毕</title>
		<link>http://iregex.org/blog/moved.html</link>
		<comments>http://iregex.org/blog/moved.html#comments</comments>
		<pubDate>Tue, 04 May 2010 01:57:32 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[杂项]]></category>
		<category><![CDATA[host]]></category>
		<category><![CDATA[regexbuddy]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=86</guid>
		<description><![CDATA[原空间(homezz.com)到期, 顺便换为法国alwaysdata.com的了. 搬家很顺利, 使用scp将数据从原空间隔空传物过去; 配置好域名dns, 数据文件, 新空间就激活了. 很顺利. 另, 新站的访问速度如何? 可以接受吗?... ]]></description>
			<content:encoded><![CDATA[<p>原空间(homezz.com)到期, 顺便换为法国alwaysdata.com的了. 搬家很顺利, 使用<a href="http://en.wikipedia.org/wiki/Secure_copy">scp</a>将数据从原空间隔空传物过去; 配置好域名dns, 数据文件, 新空间就激活了. 很顺利.</p>
<p>另, 新站的访问速度如何? 可以接受吗?</p>
<p>目前在蕴酿一篇关于&#8221;如何DIY一款像RegexBuddy那样的正则表达式工具&#8221;的博客, 敬请期待.</p>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/moved.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>[译]正则表达式：从菜鸟到大师</title>
		<link>http://iregex.org/blog/from-regex-newbie-to-regex-guru.html</link>
		<comments>http://iregex.org/blog/from-regex-newbie-to-regex-guru.html#comments</comments>
		<pubDate>Tue, 03 Feb 2009 02:06:11 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[翻译]]></category>
		<category><![CDATA[powergrep]]></category>
		<category><![CDATA[regexbuddy]]></category>
		<category><![CDATA[regexguru]]></category>
		<category><![CDATA[translation]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=55</guid>
		<description><![CDATA[Author: Jan Goyvaerts Publish Date: 2 Feb. 2009 Blog entry: http://www.regexguru.com/2009/02/from-regex-newbie-to-regex-guru/ Translated By: Rex (http://iregex.org) Rex注：本文是Jan Goyvaerts为自己的著作《Regular Expression Cookbook》写的... ]]></description>
			<content:encoded><![CDATA[<p>Author: Jan Goyvaerts<br />
  <br />Publish Date: 2 Feb. 2009 </p>
<p>Blog entry: <a title="http://www.regexguru.com/2009/02/from-regex-newbie-to-regex-guru/" href="http://www.regexguru.com/2009/02/from-regex-newbie-to-regex-guru/">http://www.regexguru.com/2009/02/from-regex-newbie-to-regex-guru/</a> </p>
<p>Translated By: Rex (<a href="http://iregex.org">http://iregex.org</a>) </p>
<p>Rex注：本文是Jan Goyvaerts为自己的著作《Regular Expression Cookbook》写的序言中的一段。</p>
<p><font color="#999999">One of my last tasks for the <a href="http://www.regexguru.com/2009/01/regular-expression-cookbook-available-for-pre-order/">Regular Expression Cookbook</a> was to write the preface, including my author bio. I told the story of how I went from my first real encounter with regular expressions in 2000, to the expert I am almost a decade later. </font></p>
<p><a href="http://iregex.org/blog/regular-expression-cookbook-available-for-pre-order.html" target="_blank">《Regular Expression Cookbook》</a>即将完工，剩余的工作之一是作序，包括写我的作者小传。我讲述了自己如何在2000年第一次遭遇正则表达式，并在近乎十年之后才成为专家的经历。</p>
<p><span id="more-55"></span></p>
<p><font color="#999999">My first attempt at writing the bio came out way too long compared with the other sections in the preface. The final bio is only half as long. Rather than let the long bio go to waste, I’m publishing it here, with added links. </font></p>
<p></font>我写的小传初稿，比序言中其它小节的篇幅要长得多，最终还是压缩到一半的长度。原版的较长自传并没有丢到故纸堆里，我将其发布到这里，并加上了链接。</p>
<blockquote style="border-left:2px solid #DDDDDD; margin:15px 30px 0 10px; padding-left:20px;">
<p><font color="#999999">In 1996, fresh out of high school, Jan Goyvaerts started a hobby project publishing his own software on his own website. It was less than a year before that Internet access had become available at local call rates to his <a href="http://www.heist-op-den-berg.be">Belgian hometown</a>. In 1999, he decided that a university degree was only a ticket to joining the rat race, and focused on his ever more successful software development venture. He set up the business that would eventually become <a href="http://www.just-great-software.com/">Just Great Software</a> in 2000.</font></p>
<p>1996年，Jan Goyvaerts高中毕业刚毕业，就在其个人网站上发布自编的软件作为业余爱好项目。一年之后，互联网才在他的<a href="http://www.heist-op-den-berg.be" rel="nofollow" target="_blank">比利时老家</a>以市话费的价格普及起来。1999年，他意识到，大学学位充其量不过是一块通向更加残酷的竞争之路的敲门砖，因此他集中精力继续做自己更加成功的软件开发。2000年，他成立了自己的公司，该公司是后来的<a href="http://www.just-great-software.com/" target="_blank">Just Great Software（绝佳软件）</a>公司的前身。</p>
<p><font color="#999999">At that time, Jan had no idea he would ever become an expert on regular expressions. One of his early successes was a postcardware text editor called EditPad. Since postcards don’t pay the bills, he developed a commercial text editor called <a href="http://www.editpadpro.com/">EditPad Pro</a>. EditPad Pro, released mid-2000, needed regular expression support to compete. Only the best regex engine would do for “Just Great Software”. Jan decided to go with <a href="http://www.regular-expressions.info/pcre.html">PCRE</a>.</font> </p>
<p></p>
<p>那时，Jan从未料到他有朝一日会成为正则表达式专家。他早期的成功项目之一是一款叫作EditPad的名信片软件。由于名信片不足以补贴家用开支，他开发了一款收费版的文本编辑器：<a href="http://www.editpadpro.com/">EditPad Pro</a>，发布时间是2000年中期。该软件以正则表达式支持作为卖点。只有最好的正则引擎才配得上“Just Great Software（绝佳软件）”这个招牌。Jan决定采用<a href="http://www.regular-expressions.info/pcre.html">PCRE</a>。</p>
<p><font color="#ff008c">(rex注：名信片软件并不是编辑名信片的软件，而是该软件近乎免费，只要给作者寄一张名信片就可以注册。)</font></p>
<p></p>
<p><font color="#999999">The regular expression features in EditPad Pro proved quite popular, particularly because PCRE offered a regex syntax compatible with <a href="http://www.regular-expressions.info/perl.html">Perl</a>, which was all the rage. Most other text editors, even the big IDEs from Microsoft and Borland, had much simpler regular expression support. (In 2009, Visual Studio and Delphi still use those same old regex flavors. This frustrates Jan, because old and limited regex flavors don’t make good book material, and both IDEs are built on .NET, which provides a very rich regex flavor fully covered in <a href="http://www.regular-expression-cookbook.com">this book</a>.)</font></p>
<p>事实证明，EditPad Pro中的正则表达式风格极受欢迎，主要是因为PRCE中的正则表达式语法与<a href="http://www.regular-expressions.info/perl.html">Perl</a>兼容，这种风格风靡一时。其它大多数的文本编辑器，包括当时的MicroSoft和Borland公司的集成开发环境，也仅仅提供非常简单的正则表达式支持。（时至2009年，Visual Studio和Delphi仍在延用其古老的正则式风格。两种集成开发环境均基于.Net，它的正则表达式风格异常丰富，这些特性在书中都在书中有全面介绍。可惜的是，这两款IDE基于.Net却在编辑器中没有体现出.Net正则式的支持，因此无法为<a href="http://www.regular-expression-cookbook.com" target="_blank">本书</a>提供更好的素材，这一点让Jan大皱眉头。） </p>
<p><font color="#ff008c">(rex注：本段末尾括号中的长句，翻译时调整了顺序，以便于理清逻辑顺序；添加了一句话作为辅助，便于读者掌握原义。)</font></p>
<p><font color="#999999">Sensing a need for more powerful tools for working with regular expressions on text files, Jan developed <a href="http://www.powergrep.com/">PowerGREP</a>. PowerGREP took a slow start in late 2002. Today, it is clearly the most powerful tool on the Microsoft Windows platform for doing anything with regular expressions. One of the differentiating features early on was the inclusion of a detailed regular expression tutorial in the help file. Most other grep tools had only help topic listing all the syntax features that you could print on a single sheet of paper. PowerGREP had a separate detailed help topic for every feature in PCRE.</font></p>
<p>Jan感觉到在使用正则式处理文本文件，需要一款更强大的工具，于是他开发了<a href="http://www.powergrep.com/">PowerGREP</a>软件。PowerGREP项目始于2002年底，起步时进展缓慢。如今，它无疑是微软平台下处理任何正则表达式工作的最强大的工具。原先它卓而不群的标志之一就是在帮助文档中包含了完备翔实的正则表达教程。其它大多数grep工具仅仅列出了所有的语法风格，篇幅不大，在一页纸上就能打印完毕。而PowerGREP对于PCRE中每一个正则式语法要点都言之甚详。</p>
<p><font color="#999999">Jan didn’t have a big budget to advertise his software. With many internet marketers preaching that content is king on the search engines, Jan set up <a href="http://www.regular-expressions.info">http://www.regular-expressions.info</a> with the text from tutorial he had already written for PowerGREP. As he watched the site’s traffic and Google rank rise, ultimately beating the Wikipedia entry at the top, Jan started getting the idea that maybe this could become his area of expertise. Writing his own regular expression engine was still a scary thought.</font></p>
<p>那时Jan并没有太多的预算来为他的软件打广告。在许多互联网营销专家鼓吹内容为王的大环境下，Jan建立了<a href="http://www.regular-expressions.info" target="_blank">http://www.regular-expressions.info</a>，内容来源于他已经为PowerGREP写好的教程。当他看到网站流量和Google Rank值不断攀升，远远超过了顶部的Wikipedia条目，Jan意识到或许这才是他的英雄用武之地。不过，编写自己的正则表达式引擎，对于那时的Jan来说，就像是建造空中楼阁一样不敢想像。</p>
<p><font color="#ff008c">(rex注：存疑：是页面顶部的wikipedia条目，还是排行名列前矛的..?)</font></p>
<p><font color="#999999">Regular expressions hit the mainstream development community when <a href="http://www.regular-expressions.info/dotnet.html">.NET</a> was released including a set of powerful regex classes. Not much later the <a href="http://www.regular-expressions.info/java.html">Java</a> platform added the same with the JDK 1.4 release. Seeing lots of Windows developers using regular expressions, and a customer base of EditPad Pro and PowerGREP users needing to test their regular expressions, Jan felt there was a need for a comprehensive tool to create, test, and edit regular expressions. <a href="http://www.regexbuddy.com/">RegexBuddy</a> was released in 2004.</font></p>
<p>附有一整套正则式类库的<a href="http://www.regular-expressions.info/dotnet.html">.NET</a>发布后，正则表达式成为开发界的主流。不久之后，<a href="http://www.regular-expressions.info/java.html">Java</a>平台也在JDK1.4发行版中加入相同内容。看到众多的Windows开发人员用上了正则表达式，以及相当数量的EditPad Pro和PowerGREP客户群需要对正则表达式进行测试，Jan感觉到，有必要开发一种集创建、测试、编辑正则式于一体的综合工具。2004年，<a href="http://www.regexbuddy.com/">RegexBuddy</a>诞生了。</p>
<p><font color="#999999">The PCRE engine which had been such a blessing in 2000 was now seriously limiting both PowerGREP and RegexBuddy. PowerGREP needed to search files larger than 2 GB, and RegexBuddy needed to be compatible with all major regex flavors, not just PCRE. Jan bit the bullet and sweat several months implementing a brand new regular expression engine. The result was a <a href="http://www.regular-expressions.info/refflavors.html">fusion regex flavor</a> that supports almost all the features found in all the regex flavors discussed in this book, and that was fast and flexible enough to meet the needs of PowerGREP’s customers. The new regex engine made the 2005 releases of PowerGREP and RegexBuddy very successful.</font></p>
<p>对于PowerGREP和RegexBuddy来说，在2000年时PCRE引擎真可谓是来自上天的恩赐，可时至如今，它却成了一种极大的限制了。PowerGREP需要搜索2GB以上的大文件，RegexBuddy也需要兼容所有的主流正则风格，而不仅仅是PCRE风格。于是Jan咬紧牙关，大干数月，终于实现了一种全新的正则式引擎。它是<a href="http://www.regular-expressions.info/refflavors.html" target="_blank">正则式风格集大成者</a>，支持本书中提及的所有正则流派的几乎所有的特性。它足够快速、灵活，满足了PowerGREP客户的需求。新的正则引擎给2005年发布的PowerGREP和RegexBuddy带来极大的成功。</p>
<p><font color="#999999">By this time, Jan had become very aware of the differences between all the regular expression flavors. While RegexBuddy could now emulate nearly all the abilities of the popular regular expression flavors, it could not emulate their deficiencies. After much research and testing, Jan released RegexBuddy 3 in 2007 which can emulate the features, and lack thereof, of 15 different regular expression flavors.</font></p>
<p>到那时，Jan对于所有正则表达式流派之间的区别了如指掌。RegexBuddy能够模拟流行的正则表达式流派的所有性能，却不能模拟它们的缺陷。经过大量研究和测试之后，Jan于2007年发布了RegexBuddy 3，该版本可以模拟15种不同的正则表达式流派的所有风格，包括缺陷。</p>
<p><font color="#999999">Having spent so much time researching regular expressions, Jan felt he was ready to write the book on regular expressions. But he didn’t actually set out to do it. It was <a href="http://blog.stevenlevithan.com">Steven Levithan</a>, a very enthusiastic RegexBuddy user, who asked him early 2008 if he wanted to co-write a book on regular expressions. Jan hesitated at first, books being much less profitable than software. After some reflection, he decided he would realize his childhood dream of seeing his name in print, before the printed book becomes obsolete.</font></p>
<p>Jan在研究正则表达式上花费的时间如此之久，他觉得自己可以写一本关于正则表达式的书了。但是他并没有动手写作。一位狂热的RegexBuddy用户，<a href="http://blog.stevenlevithan.com">Steven Levithan</a>，在2008年年初询问Jan是否愿意共同写一本关于正则表达式的书。Jan开始有些犹豫，毕竟写书不像写软件那样利润丰厚。再三考虑过之后，他意识到可以实现儿时的梦想，那就是在纸版书绝迹之前，看到自己的名字印到封面。</p>
<p><font color="#999999">The result <a href="http://www.regexguru.com/2009/01/regular-expression-cookbook-available-for-pre-order/">will be published in May 2009</a>. Enjoy.</font></p>
<p>本书将于<a href="http://iregex.org/blog/regular-expression-cookbook-available-for-pre-order.html" target="_blank">2009年5月出版</a>，敬请期待。</p>
<p><font color="#999999">Meanwhile, Jan has left cloudy Belgium for tropical Thailand. He now lives with his wife in <a href="http://www.phuket.me">Phuket</a>, where he enjoys pretending to be a tourist, even though in reality he still spends far too much time flipping the switches on his <a href="http://www.micro-isv.asia/2009/01/datahand-for-sale-again/">DataHand</a>.</font></p>
<p>于此同时，Jan离开了乌云密布的比利时，来到了泰国这个热带国家。他和妻子在普吉岛安顿下来。在这里他喜欢假装成游客，实际上他太多太多的时间还是花费在敲击自己的<a href="http://www.micro-isv.asia/2009/01/datahand-for-sale-again/">DataHand</a>键盘上。</p>
</blockquote>
<p><font color="#ff008c">Rex评：读过了《Mastering Regular Expressions》，现在很期待读一下这本CookBook。不过，作者也明示、暗示过了，RegexBuddy和PowerGREP的应用会占用书中的相当篇幅；并坦言写书不如写软件赚钱。与《MRE》的作者Jeffrey Friedl相比，Jan的商人味更浓一些，而Jeffrey的学者味更浓。我敬佩资深的学者，羡慕成功的商人，Jan集二者于一身了。理解正则表达式的原理，MRE是一本很好的教材。而CookBook的书名暗示，它就像是菜谱一样，是实用的具体技术实践的指导。这两本我都想深入读，以便了解其术。我更想读的，还包括编译原理，什么时候能够真正写一款自己的编译器，写出自己的正则表达式引擎，即使是很简单地实现。</font></p>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/from-regex-newbie-to-regex-guru.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>RegexBuddy3.2.1完全版</title>
		<link>http://iregex.org/blog/regexbuddy321.html</link>
		<comments>http://iregex.org/blog/regexbuddy321.html#comments</comments>
		<pubDate>Sat, 10 Jan 2009 18:46:42 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[软件]]></category>
		<category><![CDATA[just great software]]></category>
		<category><![CDATA[regexbuddy]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=53</guid>
		<description><![CDATA[感谢网友WNlord提供信息，我有幸下载到了RegexBuddy当前的最新版3.2.1。该版本是零售完全版，可以做生成Portable Installation。不知道RegexBuddy功能的请自行站内搜索。下载地址见文章末尾。 下载地址... ]]></description>
			<content:encoded><![CDATA[<p>感谢网友WNlord提供信息，我有幸下载到了RegexBuddy当前的最新版3.2.1。该版本是零售完全版，可以做生成Portable Installation。不知道RegexBuddy功能的请自行站内<a href="http://iregex.org/blog/tag/regexbuddy">搜索</a>。下载地址见文章末尾。<br />
<span id="more-53"></span><br />
<strong>下载地址：</strong></p>
<ul>
<li><a href="http://zhasm.com/downloads#regexbuddy3.2.1" target="_blank">深柳堂</a></li>
<li><a href="http://www.3ddown.com/soft/25208.htm" rel="nofollow" target="_blank">精品软件园</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/regexbuddy321.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>正则式软件中的TotalCMD：RegexBuddy</title>
		<link>http://iregex.org/blog/regexbuddy320.html</link>
		<comments>http://iregex.org/blog/regexbuddy320.html#comments</comments>
		<pubDate>Fri, 26 Dec 2008 18:39:08 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[软件]]></category>
		<category><![CDATA[regexbuddy]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=46</guid>
		<description><![CDATA[之前我爱正则表达式已经介绍过，RegexBuddy 是windows下（在linux下可以使用wine调用）一款超强的正则式辅助编写软件。在它的帮助下，你可以轻松编写你所需要的正则表达式，清晰地理解别人写... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://iregex.org/blog/regexbuddy320.html" target="_blank" title="http://iregex.org|我爱正则表达式"><img src="http://i293.photobucket.com/albums/mm60/zhasm/regexbuddy320.png" border="0" alt="regexbuddy 3.2.0" alt="我爱正则表达式RegexBuddy Logo"></a></p>
<p>之前<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">我爱正则表达式</a>已经介绍过，RegexBuddy 是windows下（在linux下可以使用wine调用）一款超强的<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则式</a>辅助编写软件。在它的帮助下，你可以轻松编写你所需要的<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则表达式</a>，清晰地理解别人写的<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则表达式</a>，快速测试<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则式</a>与目标文本或文件是否匹配并避免出现错误。它能帮你把<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则表达式</a>转换成你所需要的编程语言的格式，帮你收集并详细记录<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则式</a>代码库，以便将来重新使用。它还能与你最喜欢的搜索工具、编辑器集成在一起，招之即来。在我所有使用过的<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则式</a>软件中，以RegexBuddy为最强，称之为<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则式</a>软件中的<a target="_blank" href="http://xbeta.info/tag/totalcommander">TotalCMD</a>，毫不为过。</p>
<p>原来本站以留言索取的形式，向诸位同好提供过3.1.0版。在网友<strong>那个谁</strong>的协助下，我得到了更新一点的版本，3.2.0，附在文末，请按需下载。 </p>
<p><span id="more-46"></span></p>
<p>3.2.0版的RegexBuddy的主要更新有（2008年10月4日）： </p>
<ul>
<li>在拷贝、粘贴菜单：在JavaScript operator的基础之上加入了 JavaScript string 选项。R语言使用与JavaScript相同语法的字串。 </li>
<li>在拷贝、粘贴菜单：加入PowerShell字串支持。支持单引号字串，双引号字串，以及Here字串。 </li>
<li>增加了对PowerShell、R 语言的支持。 </li>
</ul>
<p>3.2.1版的RegexBuddy的主要更新有（2008年12月9日）： </p>
<ul>
<li>HTML导出时不再输出无用的滚动条。 </li>
<li>将<a href="http://iregex.org" title="http://iregex.org|我爱正则表达式" target="_blank">正则式</a>转换为Perl风格时，字符类里面的美元符总是被转义，以免出现语义混淆。 </li>
</ul>
<p>当然，每次更新都少不了一大堆的Bug Fix。</p>
<p>完整的更新历史可以参阅<a target="_blank" href="http://www.regexbuddy.com/history.html" rel="nofollow">RegexBuddy官方的history文件</a>。</p>
<p>我手头的3.2.0版，其实是3.2.0的demo版安装文件，附了一个已经<strong>部分破解并压缩</strong>过的regexbuddy.exe文件。使用时只需要安装SetupRegexBuddyDemo.exe，然后将regexbuddy.exe替换掉新安装生成的RegexBuddy.exe。</p>
<ul>
<li>说它部分破解，是因为在About菜单中，依然显示Free Evaluation Version；无法安装Portable Version。 </li>
<li>说它压缩过，是因为原装的regexbuddy.exe为4+M，而绿色版的regexbuddy.exe为1+M。 </li>
<li>3.1.0完全版是现有的比较完美的版本，可以实现Portable Version。 </li>
</ul>
<p>相关链接：</p>
<ol>
<li><a target="_blank" href="http://www.regexbuddy.com/download.html">RegexBuddy官方网站</a>，US$39.95购买最新正版3.2.1。</li>
<li>下载<a target="_blank" href="http://zhasm.com/downloads#regexbuddy3.2">RegexBuddy3.2.0</a>微限版。 </li>
<li>下载<a target="_blank" href="http://zhasm.com/downloads#RegexBuddy3.1">RegexBuddy3.1.0</a>完全版。 </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/regexbuddy320.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Just Great Software 动态</title>
		<link>http://iregex.org/blog/news-from-just-great-software-20081222.html</link>
		<comments>http://iregex.org/blog/news-from-just-great-software-20081222.html#comments</comments>
		<pubDate>Mon, 22 Dec 2008 13:01:00 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[新闻]]></category>
		<category><![CDATA[just great software]]></category>
		<category><![CDATA[powergrep]]></category>
		<category><![CDATA[regexbuddy]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=41</guid>
		<description><![CDATA[http://www.just-great-software.com/的著名产品有powergrep和regexbuddy。今天该网站释出消息，主要有以下2点： Jan Goyvaerts近来在写一本关于正则表达式的书。目前已经脱稿，有望在2009年4月份由O&#8217;Reilly... ]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.just-great-software.com/imgsite/jgsoftleft.png" alt="Just Great Software" style="border: 1px solid rgb(255, 255, 255); margin: 0px 10px 10px; clear: both; padding-left: 0px; float:right;"/><a href="http://www.just-great-software.com/">http://www.just-great-software.com/</a>的著名产品有<a href="http://iregex.org/blog/powergrep.html">powergrep</a>和<a href="http://iregex.org/blog/regexbuddy.html">regexbuddy</a>。今天该网站释出消息，主要有以下2点：</p>
<ul>
<li><a href="http://www.regexguru.com/2008/05/writing-offline/">Jan Goyvaerts</a>近来在写一本关于正则表达式的书。目前已经脱稿，有望在2009年4月份由O&#8217;Reilly出版。作者坦承，该书或许是关于正则式的最实用的著作。</li>
<li><a href="http://www.just-great-software.com/">http://www.just-great-software.com/</a>在08年的新产品不多，只对原有的几款产品作了次要升级。好消息是，自07年就开始酝酿的一款新软件的攻坚工作已经完成，会在2009年发布1.0。希望在4月份之前发布。</li>
</ul>
<p>原文来源：<a href="http://www.just-great-software.com/newsletter.html">http://www.just-great-software.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/news-from-just-great-software-20081222.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows下的正则表达式工具之五——经典的Regulator</title>
		<link>http://iregex.org/blog/regulator.html</link>
		<comments>http://iregex.org/blog/regulator.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 15:55:44 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[软件]]></category>
		<category><![CDATA[expresso]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regexbuddy]]></category>
		<category><![CDATA[regulator]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=40</guid>
		<description><![CDATA[本文介绍的the Regulator 2.0 与上一篇文章介绍的Expresso一样，都是颇有年头的软件：Expresso的最后更新日期似乎是2007年6月30日；the Regulator 2.0的上次更新，更是可追溯到2004年。可是，在没有RegexBudd... ]]></description>
			<content:encoded><![CDATA[<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" src="http://i293.photobucket.com/albums/mm60/zhasm/regulator_logo.png"> 本文介绍的the Regulator 2.0 与上一篇文章介绍的<a href="http://iregex.org/blog/expresso.html" title="Expresso|http://iregex.org|我爱正则表达式" target="_blank">Expresso</a>一样，都是颇有年头的软件：Expresso的最后更新日期似乎是2007年6月30日；the Regulator 2.0的上次更新，更是可追溯到2004年。可是，在没有RegexBuddy的日子里，the Regulator 可算是元老呢！MSDN上有篇文章《<a target="_blank" href="http://msdn.microsoft.com/zh-cn/magazine/cc300497(en-us).aspx">Ten Must-Have Tools Every Developer Should Download Now</a>》，介绍了开发者必备的10款工具之一就有the <a href="http://iregex.org/blog/regulator.html" title="Regulator|http://iregex.org|我爱正则表达式" target="_blank">Regulator</a>。作者<a target="_blank" href="http://weblogs.asp.net/rosherove/">Roy Osherove</a>在regulator的帮助文件中说，自己的Regulator的创意就来自于<a href="http://iregex.org/blog/expresso.html" title="Expresso|http://iregex.org|我爱正则表达式" target="_blank">Expresso</a>。</p>
<p><a href="http://iregex.org/blog/regulator.html" title="Regulator|http://iregex.org|我爱正则表达式" target="_blank">Regulator</a>的界面，比<a href="http://iregex.org/blog/expresso.html" title="Expresso|http://iregex.org|我爱正则表达式" target="_blank">Expresso</a>要新潮，与以前介绍过的Mtracer有几分相像。<span id="more-40"></span>看界面：<img src="http://i293.photobucket.com/albums/mm60/zhasm/regulator_main.png" width=540> </p>
<p>与<a href="http://iregex.org/blog/expresso.html" title="Expresso|http://iregex.org|我爱正则表达式" target="_blank">Expresso</a>一样，它同样支持.Net版的正则，支持将正则式导出为VB或C#格式。比起<a href="http://iregex.org/blog/expresso.html" title="Expresso|http://iregex.org|我爱正则表达式" target="_blank">Expresso</a>来，它的亮点之一是正则式部分支持语法高亮显示。</p>
<p><a href="http://iregex.org/blog/regulator.html" title="Regulator|http://iregex.org|我爱正则表达式" target="_blank">Regulator</a>有一个功能是网络搜索，即支持在软件界面上直接搜索regexlib.com上的正则代码库。这原本应该是个很实用的功能。可惜的是，我在多种情况下（代理）试用了该功能，一直不能返回搜索结果。或许是随着时间的迁移，regexlib.com更换了查询输出接口，而<a href="http://iregex.org/blog/regulator.html" title="Regulator|http://iregex.org|我爱正则表达式" target="_blank">Regulator</a>还站在望夫涯上，傻傻地使用原来的方式与regexlib.com通讯，自然接收不到任何反馈。</p>
<p>帮助文件中的搜索结果列表：<br /><img src="http://i293.photobucket.com/albums/mm60/zhasm/regulator_search_old.png"> </p>
<p>这是在我的机器上返回的空列表：<br /><img src="http://i293.photobucket.com/albums/mm60/zhasm/regulator_search.png"> </p>
<p>我登录到作者<a target="_blank" href="http://weblogs.asp.net/rosherove/">Roy Osherove</a>的博客，搜索到他的一些其它正则式项目，例如2006年10月份的<a target="_blank" href="http://weblogs.asp.net/rosherove/archive/2006/10/09/Regulazy-1.0.3-Released.aspx">Realazy</a>（将普通文本转换为正则表达式的小工具，比较傻瓜），2005年11月份的VS2005下的正则式可视化工具（<a target="_blank" href="http://weblogs.asp.net/rosherove/archive/2005/11/26/AnnoucingRegexKit10.aspx">Regular Expression Visualizers for VS 2005</a>），只可惜最近两年没有在正则式方面更新文章或软件。因此该软件估计以后也不会更新了吧。作为一款经典的免费的正则式软件，估计<a href="http://iregex.org/blog/regulator.html" title="Regulator|http://iregex.org|我爱正则表达式" target="_blank">Regulator</a>曾经风光一时；不过，在我接触正则式时起，一直用的就是Regex了。</p>
<p>最近搜集了一大堆网页正则式工具，有时间跟大家分享一下。敬请期待。 </p>
<p>附：the Regulator 2.0 (3.2MB)下载地址：via <a href="http://downloads.sourceforge.net/regulator/Regulator20Bin.zip?modtime=1189740236&#038;big_mirror=0" title="the Regulator|http://iregex.org/|我爱正则表达式">sourceforge</a> | via <a href="http://zhasm.com/downloads#regulator" target="_blank">深柳堂</a></p>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/regulator.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows下的正则表达式工具之四——强大而免费的Expresso</title>
		<link>http://iregex.org/blog/expresso.html</link>
		<comments>http://iregex.org/blog/expresso.html#comments</comments>
		<pubDate>Sat, 13 Dec 2008 03:43:21 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[软件]]></category>
		<category><![CDATA[expresso]]></category>
		<category><![CDATA[regexbuddy]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=39</guid>
		<description><![CDATA[曾经沧海难为水，除却巫山不是云。用过了RegexBuddy，再用其它的正则式辅助软件，总有些不习惯。然而本人幸好不是固步自封之辈，任何时候都勇于尝试新工具，体验新特征。这不，最近知道... ]]></description>
			<content:encoded><![CDATA[<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" alt="Expresso|http://iregex.org|我爱正则表达式" src="http://i293.photobucket.com/albums/mm60/zhasm/expresso.png" /> 曾经沧海难为水，除却巫山不是云。用过了<a title="regexbuddy" target="_blank" href="http://iregex.org/blog/regexbuddy.html">RegexBuddy</a>，再用其它的正则式辅助软件，总有些不习惯。然而本人幸好不是固步自封之辈，任何时候都勇于尝试新工具，体验新特征。这不，最近知道了<a href="http://iregex.org/blog/expresso.html" target="_blank" title="Expresso|http://iregex.org|我爱正则表达式">Expresso</a>，第一时间就想体验一把，将感受写在这里。</p>
<p><span id="more-39"></span></p>
<p>首先说一下对<a href="http://iregex.org/blog/expresso.html" target="_blank" title="Expresso|http://iregex.org|我爱正则表达式">Expresso</a>的印象。该软件理所应当支持了许多正则式功能，包括匹配、替换、分隔、分析，等等。不过，<a href="http://iregex.org/blog/expresso.html" target="_blank" title="Expresso|http://iregex.org|我爱正则表达式">Expresso</a>是以.Net为基础的，因此其正则式是.Net风格的。（《<a href="http://iregex.org/blog/mastering-regular-expressions-3rd-pdf-ebook-download.html" title="精通正则表达式第三版|http://iregex.org|我爱正则表达式" target="_blank">精通正则表达式第三版</a>》里，第9章整整一章是讲.Net正则表达式的；在《<a href="http://iregex.org/blog/regular-expression-pocket-reference.html" title="Regular Expression Pocket Reference|http://iregex.org|我爱正则表达式">Regular Expression Pocket Reference</a>》里，同样也有一章，列出了.Net/C#正则表达式的风格列表。）<a href="http://iregex.org/blog/expresso.html" target="_blank" title="Expresso|http://iregex.org|我爱正则表达式">Expresso</a>只支持将正则式导出为.Net的C#/Visual Basic/C++/CLI语言格式。比起RegexBuddy丰富的字符串风格、多语法风格，<a href="http://iregex.org/blog/expresso.html" target="_blank" title="Expresso|http://iregex.org|我爱正则表达式">Expresso</a>显得有些简陋。<a href="http://iregex.org/blog/expresso.html" target="_blank" title="Expresso|http://iregex.org|我爱正则表达式">Expresso</a>不支持语法高亮，或许是作者不喜欢使用richedit之故？无论匹配与否，输出框里全是一色的黑白色，着实有些乏味。<img src="http://i293.photobucket.com/albums/mm60/zhasm/expresso_testmode.png" width=540/> </p>
<p>不过，<a href="http://iregex.org/blog/expresso.html" target="_blank" title="Expresso|http://iregex.org|我爱正则表达式">Expresso</a>也并非毫无亮点。</p>
<ul>
<li>支持特殊字符：它支持在正则表达式中插入各种稀奇古怪的字符，当然，我这里指得的是有图形面板的支持，好让你知道你是在做什么。 </li>
<li>捕获：允许使用多种风格的捕获，包括命名捕获。没办法，这是.Net的特性。 </li>
<li>控制字符：它支持在正则表达式中插入多种控制字符，包括响铃(bell \a)、new line、vertical tab&#8230;&#8230; </li>
<li>排除匹配(Exclude Match)：即允许你选定一部分正则表达式，从而在匹配时略过该段正则式，就像它不存在一样。我觉得这一特性很实用，尤其是在调试时，你不必先删除再比较，只需将其选定即可。 <img src="http://i293.photobucket.com/albums/mm60/zhasm/expresso_designmode.png" width=540/> </li>
<li>批量验证(Validate)。你可以写一条正则式(Email、URL、变量名，等等)，然后将一大堆待验证的文本行贴至输入栏，检验其是否合法。 </li>
<li>语法分析树：它的语法分析树也很有意思。虽然也是黑白色的，但是层次很清晰。 </li>
<li>实用的可扩展的<strong>正则式锦囊</strong>(expression library)。 <img src="http://i293.photobucket.com/albums/mm60/zhasm/expresso_library.png" width=540/> </li>
<li>测试计时(Timing Tests)很有用的特性，帮助你测试单次匹配时间，以及多次匹配时间。<img src="http://i293.photobucket.com/albums/mm60/zhasm/expresso_timing_tests.png" /> </li>
<li>将正则表达式编译到文件中。或许对有特定需要的人有用吧。我从未使用C++/C#编写过需要正则表达式的程序，也没想到在程序中调用含有正则表达式的dll文件，因此该功能对我用处不大。 </li>
<li>它是<strong>免费</strong>的！虽然它需要注册，但是注册不需花钱，只需要按照提示，给作者发一封邮件即可，将你的全名告诉作者，你就会收到一封自动回复的Email，包括你的全名和以此生成的注册码。作者的本意其实是想统计一下，究竟有多少人在使用自己的软件。 </li>
</ul>
<h2 style="background-color:#99CC00; font-size:14px; padding-bottom:3px; padding-left:10px; padding-top:3px;  line-height:1.5em; margin:1.5em 0 1em;">相关链接</h2>
<ul>
<li><a title="Expresso官方网站|http://iregex.org|我爱正则表达式" href="http://www.ultrapico.com/">Expresso官方网站http://www.ultrapico.com/</a> </li>
<li><a title="Expresso|http://iregex.org|我爱正则表达式" target="_blank" href="http://www.ultrapico.com/App/Register.aspx" rel="nofollow">注册地址</a></li>
<li><a title="Expresso|http://iregex.org|我爱正则表达式" target="_blank" href="http://www.ultrapico.com/ExpressoSetup3.msi" rel="nofollow">ExpressoSetup3.0</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/expresso.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>windows下的正则式工具介绍之三：MTracer2.0介绍以及与RegexBuddy比较</title>
		<link>http://iregex.org/blog/mtracer-vs-regexbuddy.html</link>
		<comments>http://iregex.org/blog/mtracer-vs-regexbuddy.html#comments</comments>
		<pubDate>Tue, 16 Sep 2008 03:29:13 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[软件]]></category>
		<category><![CDATA[chinese]]></category>
		<category><![CDATA[mtracer]]></category>
		<category><![CDATA[powergrep]]></category>
		<category><![CDATA[regexbuddy]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=32</guid>
		<description><![CDATA[RegexBuddy和PowerGrep是我在windows下常用的两款正则式工具。前者是帮助编写正则式的辅助工具，后者是进行批量搜索替换的实用工具。这两款软件都是外国人写的。今天介绍国人史寿伟先生写的一... ]]></description>
			<content:encoded><![CDATA[<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" src="http://www.regexlab.com/images/logo_s.gif" />RegexBuddy和PowerGrep是我在windows下常用的两款正则式工具。前者是帮助编写正则式的辅助工具，后者是进行批量搜索替换的实用工具。这两款软件都是外国人写的。今天介绍国人<a target="_blank" href="http://www.softreg.com.cn/Search.aspx?t=authorid&amp;v=/efff07ff-b552-4034-8860-1964f285c4fc/">史寿伟先生</a>写的一款正则式工具，MTracer 2.0。 </p>
<p><span id="more-32"></span></p>
<p>&#160;</p>
<h2 style="background-color:#99CC00; font-size:14px; padding-bottom:3px; padding-left:10px; padding-top:3px;  line-height:1.5em; margin:1.5em 0 1em;">MTracer 2.0软件版本</h2>
<p>MTracer2.0全名是RegexMatchTracer，官方主页在regexlab.com。上面说最近更新日期是2007.10.07，不过，从我今天下载的程序的修改日期来看，是2008.09.13。变化是，之前作者提供的是绿色的程序，现在提供的是msi的安装包。 本文以下提到MTracer时，若无特殊说明，均指MTracer2.0。</p>
<p>&#160;</p>
<h2 style="background-color:#99CC00; font-size:14px; padding-bottom:3px; padding-left:10px; padding-top:3px;  line-height:1.5em; margin:1.5em 0 1em;">MTracer软件特性</h2>
<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" src="http://i3.6.cn/cvbnm/61/db/85/73daa684cce5f9fe1d6f327aa5d5502c.jpg" />作为一款正则表达式撰写辅助程序，它拥有查找匹配、替换模式、分割模式，可以分别进行相应操作。前两种用的比较多，各种语言或正则式工具都有相应语句或函数来实现；第三种<strong>分割模式</strong>是指<strong>使用正则表达式来描述字符串的分割符，以便将字串分割成子串数组。</strong>举个简单的例子来说，可以使用正则式<tt class="regex">\d+;?</tt>将<tt class="string">abcd12;sdf55656asdfasd82asd33x</tt>字串分割成子串数组：</p>
<ul>
<li>abcd </li>
<li>sdf </li>
<li>asdfasd </li>
<li>asd </li>
<li>x </li>
</ul>
<p>在实际操作时，你总会遇到使用分割模式才能最有效率地解决的问题。</p>
<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" src="http://i3.6.cn/cvbnm/df/9f/96/cfd4162eebd15ed35237a49bf94b82ae.jpg" /> 除了一般的选项（忽略大小写、单行\多行、全局），它提供了从右向左、扩展模式两种匹配选项。</p>
<p><strong>从右向左</strong>：平时查找字串最右边的正则式匹配，可以借助于<tt class="regex">?</tt>和<tt class="regex">$</tt>来定位。而在MTracer下，这款比较令人耳目一新的选项十分好玩，虽然我还没有在实际操作时遇到过确需此选项的例子。</p>
<p><strong>扩展模式</strong>：包括如下选项：</p>
<ul>
<li>注释 <tt class="regex">(?#xxx)</tt>：在正则式中加入注释以便提高可读性； </li>
<li>模式修改符 <tt class="regex">(?ismg-ismg)</tt>：小范围内修改匹配模式； </li>
<li>非捕获组 <tt class="regex">(?:xxx)</tt>：匹配而不捕获，便于计数，同时还可以节省内存，提高效率（根据《精通正则表达式》的说法）； </li>
<li>预搜索（零宽度断言）：十分有用的匹配选项，<strong>只匹配位置，而不消耗字符</strong>；有四种模式，详见<a target="_blank" href="http://www.mediafire.com/?ugf3z8tklbl">手册</a>； </li>
<li>独立表达式 <tt class="regex">(?&gt;pattern)</tt>：此选项在《精通正则表达式》中，被余晟先生翻译为&#8220;固化分组&#8221;，即无论匹配成功与否，内部都不进行回退，都不会再次尝试匹配； </li>
<li>条件表达式<tt class="regex">(?(x)y|z)</tt>：与C语言的三目操作符类似，x条件为真则进行y匹配，否则进行z匹配。其中x部分有四种模式，详见<a target="_blank" href="http://www.mediafire.com/?ugf3z8tklbl">手册</a>； </li>
<li>递归表达式 <tt class="regex">(?R)</tt>：对另一部分子表达式的引用，而不是对其匹配结果的引用。当被引用的表达式包含自身，则形成递归引用。 </li>
</ul>
<p>个人比较常用的选项是非捕获组和预搜索。</p>
<p>&#160;</p>
<h2 style="background-color:#99CC00; font-size:14px; padding-bottom:3px; padding-left:10px; padding-top:3px;  line-height:1.5em; margin:1.5em 0 1em;">MTracer最有用的特性</h2>
<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" src="http://i3.6.cn/cvbnm/1c/a8/f0/2fed4bd2ff41a771aecc1558210c5442.jpg" /> 相对于另一款正则式撰写辅助程序RegexBuddy而言，MTracer最有用的特性是中文的正则式分析树。虽然RegexBuddy也有此功能，但是MTracer的正则式分析树是中文的。这对于需要此功能但是不愿意使用英文软件的用户来说非常方便。对于初学者也很有帮助。</p>
<p>值得说明的是，正则式的中文术语在中文里还没有形成统一的规范。以我自身的阅读经历而言，似可分为两类：何伟平译的《Perl Programming》第三版中大量使用的正则式术语译法为第一套方案，余晟先生译的《精通正则表达式》第三版中使用的正则表达式为第二套。个人倾向于第二套。</p>
<p>MTracer使用的正则表达式术语，与这两套术语均有相异之处。</p>
<p>如果有人使用上述第二套术语将RegexBuddy汉化的话，估计在中国的普及率会大幅提高。题外话。</p>
<p>&#160;</p>
<h2 style="background-color:#99CC00; font-size:14px; padding-bottom:3px; padding-left:10px; padding-top:3px;  line-height:1.5em; margin:1.5em 0 1em;">&#160;</h2>
<h2 style="background-color:#99CC00; font-size:14px; padding-bottom:3px; padding-left:10px; padding-top:3px;  line-height:1.5em; margin:1.5em 0 1em;">与RegexBuddy的简单比较</h2>
<p>还是列表说明吧。</p>
<table border="1" cellspacing="1" cellpadding="2" width="401">
<tbody>
<tr>
<td width="105" align="center"><strong>属性</strong></td>
<td width="132" align="center"><strong>MTracer</strong></td>
<td width="158" align="center"><strong>RegexBuddy</strong></td>
</tr>
<tr>
<td width="103">界面语言</td>
<td width="132">中文</td>
<td width="159">英文</td>
</tr>
<tr>
<td width="102">大小</td>
<td width="132">471kb</td>
<td width="160">9.1 MB</td>
</tr>
<tr>
<td width="103">价格(单用户)</td>
<td width="131">个人RMB49.00<br />
        <br />公司RMB298.00</td>
<td width="160">US$ 39.95</td>
</tr>
<tr>
<td width="103">免费版的限制</td>
<td width="131">正则式长度限制</td>
<td width="160">7天免费使用时间</td>
</tr>
<tr>
<td width="103">帮助文件</td>
<td width="131">原来版本有，最新的msi版已经不带帮助文件；需要的话可以下载本站上传的<a target="_blank" href="http://www.mediafire.com/?ugf3z8tklbl">手册</a>。</td>
<td width="160">齐全。包括4本电子书，其中3本是关于正则表达式的教程、参考手册，1本是RegexBuddy的操作手册。十分翔实。语言是英文。</td>
</tr>
<tr>
<td width="103">匹配模式</td>
<td width="131">
<ol>
<li>匹配 </li>
<li>替换 </li>
<li>分割 </li>
</ol>
</td>
<td width="160">
<ol>
<li>匹配 </li>
<li>替换 </li>
<li>分割 </li>
</ol>
</td>
</tr>
<tr>
<td width="103">匹配选项</td>
<td width="131">
<ol>
<li>忽略大小写（开关） </li>
<li>单行、多行 </li>
<li>全局局部可选 </li>
<li>从右至左 </li>
<li>扩展模式（详见上文） </li>
</ol>
</td>
<td width="160">
<ol>
<li>忽略大小写 （开关） </li>
<li>单行、多行 </li>
<li>默认全局 </li>
<li>点号匹配新行 </li>
<li>^$匹配换行符 </li>
<li>空白字符宽松模式 </li>
<li>扩展模式（依语言而定） </li>
</ol>
</td>
</tr>
<tr>
<td width="103">历史功能</td>
<td width="131">&#8220;文本片断&#8221;即是</td>
<td width="160">History</td>
</tr>
<tr>
<td width="103">导出字串为指定语言</td>
<td width="131">
<ol>
<li>原状导出 </li>
<li>Visual Basic </li>
<li>C/C++ </li>
</ol>
</td>
<td width="160">
<ol>
<li>原状导出 </li>
<li>C/C# </li>
<li>Perl(m//或s///格式) </li>
<li>Basic </li>
<li>Java </li>
<li>JavaScript </li>
<li>Pascal </li>
<li>PHP (//) </li>
<li>PostgreSQL </li>
<li>Python </li>
<li>Ruby </li>
<li>SQL </li>
<li>Tcl </li>
<li>XML </li>
<li><strong>还包含在上述语言中如何调用该正则式的模块，功能强大、有用、好用。（Use）</strong> </li>
</ol>
</td>
</tr>
<tr>
<td width="103">常用正则库</td>
<td width="131">帮助文件中有提及</td>
<td width="160">程序中包含该功能，有定义、例代码、匹配实例。<br />
        <br />帮助文件中也有。</td>
</tr>
<tr>
<td width="103">扩展性</td>
<td width="131">支持插件（疑安装目录下的stdplgin.dll是其插件，功能不详。）</td>
<td width="160">与PowerGrep相关联。</td>
</tr>
<tr>
<td width="103">帮助论坛</td>
<td width="131">开放，地址<a target="_blank" href="http://www.regexlab.com/zh/discuss/forum.aspx?b=1">在此</a></td>
<td width="160">仅对付费注册软件的用户开放。</td>
</tr>
<tr>
<td width="103">界面高度可定制</td>
<td width="132">不支持</td>
<td width="161">支持</td>
</tr>
<tr>
<td width="103">是否支持批量替换外部文件</td>
<td width="132">不支持</td>
<td width="161">支持</td>
</tr>
</tbody>
</table>
<p>当然，没有提到的功能、细节还不少，这里仅仅是列出本人关注的属性。</p>
<p>&#160;</p>
<h2 style="background-color:#99CC00; font-size:14px; padding-bottom:3px; padding-left:10px; padding-top:3px;  line-height:1.5em; margin:1.5em 0 1em;">MTracer 2.0注册</h2>
<p>付出劳动，换来报酬，是当今任何行业都认可的规则。MTracer需要注册费，这一点也十分正常。其价格是48元人民币。比起US$ 39.95的RegexBuddy来，可谓性价比极高。</p>
<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" src="http://i3.6.cn/cvbnm/a7/08/a1/f3e2daa8f96c1c47d4b08ef7a6c14224.jpg" /> </p>
<p>如果不注册，会有什么限制呢？请看图。哦，是有100个字符的限制。</p>
<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" src="http://i3.6.cn/cvbnm/4c/d6/e2/5dcb18e7a4610987954ee363624a3584.jpg" /> 这是注册后的图。</p>
<p>对于未注册版本，平时写一些短小的正则式，是没有问题的。如果想无限制地使用该程序，花48元支持一下国产程序，何乐而不为？</p>
<p>现在无论主动还是被动，版权意识都在深入人心。这也是本人一直没有把完全版的RegexBuddy和PowerGrep的下载链接贴到blog上、而是采取来Email索取的原因之一。</p>
<p><img style="border-bottom: rgb(255,255,255) 1px solid; border-left: rgb(255,255,255) 1px solid; margin: 0px 10px 10px; padding-left: 0px; float: right; clear: both; border-top: rgb(255,255,255) 1px solid; border-right: rgb(255,255,255) 1px solid" src="http://i3.6.cn/cvbnm/06/e9/0d/fe543fab025def9627a7f1a4df30f354.jpg" /> MTracer2.0采用注册号的方式注册。看来作者深知在国内破解成风，于是很幽默地添加了这样一则菜单选项：如何8小时破解本软件？呵呵。8小时我们可以做许多事情，没有必要浪费在track、debug、crack上。你的时间很值钱的。</p>
<p>这两款软件的完全版我这里都有，如果需要RegexBuddy的话，请占击链接留下信箱索取即可；但是MTracer的话就<strong>不要</strong>索取了。</p>
<p>&#160;</p>
<h2 style="background-color:#99CC00; font-size:14px; padding-bottom:3px; padding-left:10px; padding-top:3px;  line-height:1.5em; margin:1.5em 0 1em;">相关阅读</h2>
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;"><a href="http://iregex.org/blog/regexbuddy.html">windows下的正则式工具介绍之一：RegexBuddy</a></h4>
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;"><a href="http://iregex.org/blog/powergrep.html">windows下的正则式工具介绍之二：powergrep</a></h4>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/mtracer-vs-regexbuddy.html/feed</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>windows下的正则式工具介绍之二：powergrep</title>
		<link>http://iregex.org/blog/powergrep.html</link>
		<comments>http://iregex.org/blog/powergrep.html#comments</comments>
		<pubDate>Mon, 05 May 2008 08:18:09 +0000</pubDate>
		<dc:creator>rex</dc:creator>
				<category><![CDATA[软件]]></category>
		<category><![CDATA[powergrep]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regexbuddy]]></category>
		<category><![CDATA[正则式]]></category>
		<category><![CDATA[正则表达式]]></category>

		<guid isPermaLink="false">http://iregex.org/?p=7</guid>
		<description><![CDATA[上文介绍了RegexBuddy，本文介绍另一款windows下的正则式软件：PowerGREP，号称“The Most Powerful GREP Tool for Windows”，windows下最强大的GREP工具。看清楚了，是最强大，而非之一。与RegexBuddy一样，也是... ]]></description>
			<content:encoded><![CDATA[<p>上文介绍了RegexBuddy，本文介绍另一款windows下的正则式软件：PowerGREP，号称“The Most Powerful GREP Tool for Windows”，windows下最强大的GREP工具。看清楚了，是<font color="#ff0084">最强大</font>，而非<font color="#ff0084">之一</font>。与RegexBuddy一样，也是商业软件，其售价为US$149.00，合人民币1000有奇。如果说RegexBuddy是撰写正则式的贴心助手，那么PowerGREP则是应用正则式在文本文件中搜索替换的强大工具。现在我们看看，它究竟有什么功能敢号称<b>最强</b>。</p>
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;">基本界面</h3>
<p><a target="_blank" href="http://www.powergrep.com/screens/powergrep800.png"><img style="max-width: 800px;" src="http://www.powergrep.com/screens/powergrep320.png" /></a></p>
<p>点击可以看大图。另外，还有一组图片来自<a target="_blank" href="http://www.powergrep.com">powergrep</a>官网，附上了官网的部分介绍，以及个人评论。</p>
<ul>
<li>内容搜索图片，点<a target="_blank" href="http://www.powergrep.com/screens/powergrep800.png">这里</a>；<br />
在本抓图中，我搜索了<font color="#ff0084">c:\My Documents\My Web Sites</font>文件夹及其子目录下所有的html文件。我使用了一条正则表达式把搜索范围限定在HTML tag之内，使用另一条正则式在这些<span class="hl">标记中搜索所有的email地址。</p>
<p></span></li>
<li>搜索和替换，点<a target="_blank" href="http://www.powergrep.com/screens/replacepreview.png">这里</a>和<a target="_blank" href="http://www.powergrep.com/screens/replace.png">这里</a>；<br />
一个好用的功能是可以<font color="#ff0084">预览</font>结果而不是立即替换。匹配结果以黄色标出。双击匹配就能打开对应的文档并检验其内容。<br />
点击<font color="#ff0084">执行</font>后，颜色改变，表示已经实施替换。</p>
</li>
<li>收集信息和统计数据，点<a target="_blank" href="http://www.powergrep.com/screens/collect.png">这里</a>；<br />
本例是“检测Apache网络日志－－google search terms”的例子。本例使用的正则式在PowerGREP帮助文档中有详细讲解。</p>
</li>
<li>灵活的“撤消”历史记录，让你不再抓狂，点<a href="http://www.powergrep.com/screens/undo.png" target="_blank">这里</a>；<br />
在执行替换的同时，PowerGREP已经备份了原文件。只要你没有手动删除这些备份的文件，你可以随便撤消你做过的任何操作。世界上真有后悔药的呀。</p>
</li>
<li>搜索PDF文档，点<a target="_blank" href="http://www.powergrep.com/screens/pdf.png">这里</a>；<br />
PDF也能使用正则式进行搜索？当然了，你没有看错。只是，要确保PDF文档中你要搜索的内容是<font color="#ff0084">文字</font>而非<font color="#ff0084">图像</font>。也就是说，扫描版的PDF不享受此功能的哟。</p>
</li>
<li>在MS word 文档中搜索，点<a target="_blank" href="http://www.powergrep.com/screens/msword.png">这里</a>；<br />
这个功能也十分有用。我记得还有个东东叫<a target="_blank" href="http://www.viemu.com/">ViEmu for Word &amp; Outlook</a>，可以在word和outlook中模拟vim，当然可以使用正则式搜索替换了。不过，ViEmu一来也是收费软件（在2008年5月31日之前是79美刀，之后是99美刀），我还没有找到免费版本；二来其正则式是vim风格的，只习惯Perl风格的同学可能不太习惯。在google documents里也支持正则式搜索了，具体语法、风格尚未广泛测试。</p>
</li>
<li>在MS Excel中搜索，点<a target="_blank" href="http://www.powergrep.com/screens/excel.png">这里</a>；<br />
同样也是批量搜索、替换。不单单是对一个文档、一个sheet。</p>
</li>
<li>以16进制模式，在2进制文档中搜索，点<a target="_blank" href="http://www.powergrep.com/screens/binaryfiles.png">这里</a>；<br />
跟二进制编辑器界面类似，多了正则式批量搜索替换功能。</p>
</li>
<li>在zip压缩文档中搜索，点<a target="_blank" href="http://www.powergrep.com/screens/zip.png">这里</a>；<br />
把zip文件当作普通文件夹来搜索。很强大吧？</p>
</li>
<li>正则表达式序列，点<a target="_blank" href="http://www.powergrep.com/screens/sequence.png">这里</a>；<br />
大多数正则式工具一次只支持一条正则式的操作。而PowerGREP可以一次执行多条正则式！使用checkbox来进行多项选择。</p>
</li>
<li>定制颜色显示，点<a target="_blank" href="http://www.powergrep.com/screens/colors.png">这里</a>；<br />
该功能比较一般。除非软件中的颜色设置特傻，一般我是不会改变默认颜色搭配的。
</li>
</ul>
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;">功能演示</h3>
<p>PowerGREP官网还提供了一组flash做的demo，见下。</p>
<ul>
<li>使用正则式匹配email地址(2&#8217;47&#8221;)。点<a target="_blank" href="http://www.powergrep.com/demos/email.swf">这里</a>；</li>
<li>升级版权信息(3&#8217;38)。点<a target="_blank" href="http://www.powergrep.com/demos/copyright.swf">这里</a>；</li>
<li>与RegexBuddy的无缝链接(1&#8217;57&#8221;)，点这里；两个软件是亲兄弟，当然哥俩好啦！
</li>
<li>文件选择(3&#8217;08&#8221;)，点<a target="_blank" href="http://www.powergrep.com/demos/filesel.swf">这里</a>；PowerGREP提供了贴心的特性，来帮助你筛选需要的文档。</li>
<li>其它特性(8&#8217;37&#8221;)，点<a target="_blank" href="http://www.powergrep.com/demos/action.swf">这里</a>；总而言之，PowerGREP是功能强大。自己发掘吧！</li>
</ul>
<h3 style="color: #127ADB; font-size:14px; padding-bottom:3px; padding-top:3px; margin:1.5em 0 1em;">软件下载</h3>
<p> 目前其最新版为3.4.2，更新于2008年1月18日。其官网为<a href="http://www.powergrep.com/" target="_blank">www.powergrep.com</a>，可以去下载其最新版试用。<strong>该软件为商业软件</strong>。
<ul>
<li>如果你偶然路过，尝新而已，那只需<a href="http://www.powergrep.com/download.html" target="_blank">下载试用版</a>即可；</li>
<li>如果你觉得好用、准备常用、手有余钱、非正版不用，不妨<a http:="" www.powergrep.com="" buynow.html="">花美金购买</a>；要花人民币1000多块哟^_^</li>
<li><del datetime="2009-01-08T01:51:13+00:00">如果你喜欢它，同时你认为优秀的网络资源是应该和朋友免费分享的，从而想获得该软件的全功能免费版，好吧，我也成全你，请在本文后留言（附邮箱），我会把这个小东西的链接发给你(最新版为3.4.2，我手头的全功能版为3.3.3，也足够用了)。</del><strong>更新：</strong><br />
请移步至此下载<a href="http://iregex.org/blog/powergrep350.html">PowerGREP 3.5.0</a>版。</li>
</ul>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
]]></content:encoded>
			<wfw:commentRss>http://iregex.org/blog/powergrep.html/feed</wfw:commentRss>
		<slash:comments>114</slash:comments>
		</item>
	</channel>
</rss>

