Re: fast regex

2010-05-11 Thread Paul Rubin
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: “Fast regex” is a contradiction in terms. You use regexes when you want ease of definition and application, not speed. For speed, consider hand-coding your own state machine. Preferably in a compiled language like C

Re: fast regex

2010-05-11 Thread Bryan
Lawrence D'Oliveiro wrote: “Fast regex” is a contradiction in terms. You use regexes when you want ease of definition and application, not speed. Python or Perl regex's are not actually regular expressions. Real regular expression compilers produce blazing fast results, but they cannot support

Re: fast regex

2010-05-11 Thread Nobody
On Tue, 11 May 2010 17:48:41 +1200, Lawrence D'Oliveiro wrote: I was working with regex on a very large text, really large but I have time constrained. “Fast regex” is a contradiction in terms. Not at all. A properly-written regexp engine will be limited only by memory bandwidth, provided

Re: fast regex

2010-05-10 Thread Lawrence D'Oliveiro
In message d46338a8-d08c-449b-b656-a6cf9f6a6...@l28g2000yqd.googlegroups.com, james_027 wrote: I was working with regex on a very large text, really large but I have time constrained. “Fast regex” is a contradiction in terms. You use regexes when you want ease of definition and application

Re: fast regex

2010-05-08 Thread Bryan
Tim Chase wrote: James wrote: [Tim had written:] If the keys in your word_list are more than just words, then the regexp may not find them all, and thus not replace them all.  In that case you may have to resort to my 2nd regexp which builds the 5k branch regexp from your actual dictionary

Re: fast regex

2010-05-08 Thread MRAB
Bryan wrote: Tim Chase wrote: James wrote: [Tim had written:] If the keys in your word_list are more than just words, then the regexp may not find them all, and thus not replace them all. In that case you may have to resort to my 2nd regexp which builds the 5k branch regexp from your actual

Re: fast regex

2010-05-07 Thread Helmut Jarausch
On 05/06/10 16:52, james_027 wrote: hi, I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Have a look at

Re: fast regex

2010-05-07 Thread Tim Chase
[your reply appears to have come only to me instead of the mailing list; CC'ing c.l.p in reply] On 05/06/2010 10:12 PM, James Cai wrote: When you say This does a replacement for every word in the input corpus (possibly with itself), but only takes one pass through the source text. It sounds

Re: fast regex

2010-05-07 Thread Patrick Maupin
On May 6, 9:44 pm, james_027 cai.hai...@gmail.com wrote: On May 6, 11:33 pm, John Bokma j...@castleamber.com wrote: james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or

fast regex

2010-05-06 Thread james_027
hi, I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Thanks, James -- http://mail.python.org/mailman/listinfo/python-list

Re: fast regex

2010-05-06 Thread Javier Collado
Hello, 2010/5/6 james_027 cai.hai...@gmail.com: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? re2 (http://code.google.com/p/re2/) is suppossed to be faster

Re: fast regex

2010-05-06 Thread John Bokma
james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Hard to answer without seeing your regex and requirements first. Your

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma j...@castleamber.com wrote: james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Hard to

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma j...@castleamber.com wrote: james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Hard to

Re: fast regex

2010-05-06 Thread Tim Chase
On 05/06/2010 09:11 PM, james_027 wrote: for key, value in words_list.items(): compile = re.compile(r\b%s\b % key, re.IGNORECASE) search = compile.sub(value, content) where the content is a large text about 500,000 characters and the word list is about 5,000 You don't specify what

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma j...@castleamber.com wrote: james_027 cai.hai...@gmail.com writes: I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Hard to