Page MenuHomePhabricator

Listpages.py does not havefilter option for negative grep.
Closed, InvalidPublicFeature

Description

Feature summary (what you would like to be able to do and where):

-grepnot:regexpr filter to exclude pages containing the regular expression provided when specifying filters for the listpage script in pywikibot

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):

Recently i was wanting to do a query to find Pages on Wikisource, that do not contain a specific string, namely '\<pages'

I can use a command like:-

pwb.py listpages -ns:0 -usercontribs:"ShakespeareFan00"  -intersect -titleregexnot:"1911" -grep:"\<pages"  -lang:en -family:wikisource  -format:"{page.loc_title}" | sort > checkpages_IP

to generate a list based on 'positive' inclusion criteria for 'grep'

What I cannot currently do is :-

pwb.py listpages -ns:0 -usercontribs:"ShakespeareFan00"  -intersect -titleregexnot:"1911" -grepnot:"\<pages"  -lang:en -family:wikisource  -format:"{page.loc_title}" | sort > checkpages_IP

To generate a list of pages not containing the regular expression concerned. In this instance I was attempting to find a list of my edits to Main namespace that did not contain a pages tag, so I could match them up with Index: and convert them to be scan-backed using page transclusion.

Benefits (why should this be implemented?):

Whilst manually writing regular expressions to exclude certain phrases ( with negative lookahead?) is feasible, it's far harder than writing expressions to include them (I've not so far found a regexp that works reliably), thusly it's faster to write for positive regexps, and have the exclusion implemented in the filter rather than having to write complicated expressions manually.

Event Timeline

ShakespeareFan00 triaged this task as Low priority.

A quick test seems to confirm the requested feature is already implemented, but not seemingly documented as such.