Posts Tagged ‘perl’

关于 Trie 的介绍,请读上文Trie,此不赘述。本文主要分析 Trie 实现原理,并给出 Python 的实现。

...
Sunday, August 1st, 2010 at 22:58 2 comments

从《Effective Perl》上学习到一个module:Regexp::Trie。它属于正则优化类的module,具体说来,就是提取出备选项文本的公共部分,构造“检索树”,以便最大程度上减少回溯,提升效率。

...
Sunday, August 1st, 2010 at 08:51 0 comments

笔记三则,贴在这里。

...
Monday, June 21st, 2010 at 23:04 4 comments

网友cfc4n问及关于(?!)的正则表达式问题。回答之后,顺便总结了一下Perl语言中如何匹配“不出现”某元素,贴在这里。

...
Monday, May 24th, 2010 at 16:46 1 comment

其实RegexBuddy挺好用的,我一直用它。它的用法、好处,可以写好多文字,本站也做过介绍;不过,也有理由不用它,同时这也是撰写本文的一个原因。我动了动脑筋,花了一点时间,已经做...

Wednesday, May 12th, 2010 at 13:32 13 comments

问题 以下摘自某网友来信: 难点 javascript不支持点号匹配换行符, 因此无法直接进行多行匹配; 处理前面没有http:的//, 当然要用否定前瞻( negative lookbehine)了:(?< !http:)\/\/. 可惜javascript不...

Saturday, April 3rd, 2010 at 17:51 13 comments

rex按: 写完上一篇文章之后,一直在考虑如何真正实现从普通文本中归纳正则表达式的实现。走了许多弯路,也学了不少知识。例如,perl黑豹书上复杂的数据结构、匿名散列和数组、refenrenc...

Tuesday, March 9th, 2010 at 02:32 3 comments

近来工作中需要将某种明文字串转为简单的正则式。手动做当然可以,但是大量重复性的劳动,自然是交给机器处理为好。昨晚写了一款这样的脚本,放在这里。因为是处理我自己的工作的...

Wednesday, February 10th, 2010 at 16:50 2 comments

假设样本文件a.txt内容如下: 123456hello world! hello world! I love regex. hello world! I love regex. hello world! 简单观察可知,hello world!共重复4行;I love regex.重复2行。如何使用正则表达式来写一个程序,统...

Saturday, February 6th, 2010 at 15:09 7 comments

原文在此。rex译于2009年12月15~17日,翻译过程中使用的是google docs@prism@firefox@ubuntu 9.10,很爽的体验。感谢余晟老师在正则和翻译方面的悉心指导。 平时我们用到的正则表达式,其实没那么...

Wednesday, December 16th, 2009 at 23:06 8 comments

本程序将数字转换为英文的美元数,如: 输入 1./num2eng.pl 1,100,834.10 则输出: 1Total: Say US Dollars One Million One Hundred Thundsand Eight Hundred and Thirty-Four and Ten Cents Only. 注意事项: 整数部分可以使用...

Sunday, February 15th, 2009 at 13:09 0 comments

页内导航: 能否只用官方的API来获取全部饭否消息? 饭否消息结构 使用regex解析饭否消息 使用xml解析饭否消息 两相比较 相关阅读 批量导出饭否程序的方法很多,但是基本思路都是先将该...

Wednesday, October 8th, 2008 at 18:53 5 comments

URL 饭否私信分为两种,一种是我收到的私信,一种是我发出的私信。 我收到的私信:http://fanfou.com/privatemsg/p.(1-N) 我发出的私信:http://fanfou.com/privatemsg/sent/p.(1-N) 上面的地址中不含饭否ID;需...

Saturday, May 31st, 2008 at 12:07 0 comments

俗话说,工欲善其事,必先利其器。关于windows下的正则表达式工具,这里推荐的是:RegexBuddy和PowerGREP。在linux下,也有好用的正则表达式工具,例如grep的兄弟们,只不过是都是基于命令行的...

Wednesday, April 30th, 2008 at 21:00 96 comments

以前在chinaunix回答过这样一个问题,用到了正则表达式(而且我认为正则式解决此类问题是最合适的。) 学英语的一些例句,每句都有若干词根相同的词,例如 She swears to wear the pearls that appe...

Friday, April 25th, 2008 at 16:07 1 comment
Page 1 of 11