I use sometimes the regex that finds paragraphs
containing given words w1,w2,... in any order ( I define "paragraph"
as separated by lines, \n\n).

I use the pattern like this: (two-word example, w1 and w2, but easily
expandable for N words):
       /\c\(.\|.\n\)*\<w1\>\&\(.\|.\n\)*\<w2\>
      (and I set :set maxmempattern=20000 )
This works. But search time is unbelievably slow on big files.

My question is; is there a rewrite of this  regex that works faster.

To see the testcase how of how slow this works:
  1. wget http://www.vmunix.com/~gabor/c/draft.html
     # this is ~1.3 MB file.
  2. vim draft.html
  3. /\c\(.\|.\n\)*\<w1\>\&\(.\|.\n\)*\<w2\>
     This search never finishes for me.

How  can I rewrite the regex to search faster ?

Yakov

Reply via email to