Bináris,
IndexError: no
such group
no such group
This occurs when you use a condtional group and it does not exist and you
refer to it.
In this case (.*$) will match an empty part and in that case \2 refers to
nothing.
I've been playing around with this idea, but I can't see why (.*$) would
match an empty part. Especially why it would match an empty part in some
cases, while with other pages (or with other match terms instead of
(WordPress)) it works perfectly.
The match term is: '(?si)\b(WordPress)\b(.*$)'
...and the replace term is: '\1\2\n[[Category:Appropedia WordPress
site]]'
Even if the (WordPress) group occurred at the precise end of a page, that
should just mean there is no match, right? I even tried searching for such
cases, using '(?si)\bWordPress$' - but it gave no hits.
I also realized that in this case, I didn't need two groups, so I combined
them into a single group. At least it made the command simpler, but it
still gave the same "IndexError: no such group" error, when searching for
(WordPress), and again worked perfectly when using different terms -
(?:solar panels?|photovoltaics?) or (wind power).
I think I've gone as far as I can with this approach (and need to get back
to work). I'll try pdb, and see what I can learn about python by looking at
basic.py.
Thanks.
--
Chris Watkins
Appropedia.org - Sharing knowledge to build rich, sustainable lives.