Hello! It would be nice, if you add -match option to pagegenerators.py, that means that script will work only on pages which match some regexp.
I know a workaround for this in compat, but that feature has not been ported to core yet. Hopefully will be soon...
(First round: use replace.py "someregex" "foobar" -save:something.txt, then do the actual replacements with -file:something.txt.
As far as I can see, the -grep option provides this:
-grep A regular expression that needs to match the article otherwise the page won't be returned. Multiple -grep:regexpr can be provided and the page will be returned if content is matched by any of the regexpr provided. Case insensitive regular expressions will be used and dot matches any character, including a newline.
OK. Replace.py is very important for me as I heavily use it for multiple purposes, and I am highly interested in its performance. I contributed a lot to the compat version, but now I have troubles both with using the core and with coming back to development, but I will look inside the problem when I am able.
No, -grep matches the page contents. -titleregex matches the page title. This is clearly documented (https://github.com/wikimedia/pywikibot-core/blob/master/pywikibot/pagegenerators.py#L307, https://github.com/wikimedia/pywikibot-core/blob/master/pywikibot/pagegenerators.py#L226), and corresponds (as far as I can see) to the actual code.
But maybe the more important difference:
- -search:'insource://' is a generator
- -grep is a filter
Because -search:'insource://' is not ideal (missing support for \s, \n, ^, $, ...), a solution to this task would be still helpful