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 answer without seeing your regex and requirements first. > Your question is like: I had a meal yesterday and it upset my > stomach. Can you suggest a different meal for today? > > -- > John Bokma j3b > > Hacking & Hiking in Mexico - http://johnbokma.com/http://castleamber.com/- > Perl & Python Development
I am doing something like this 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 Any optimization for the code above? -- http://mail.python.org/mailman/listinfo/python-list