Jump to content

Manual:grep.php

From mediawiki.org
This page is a translated version of the page Manual:Grep.php and the translation is 42% complete.
MediaWiki バージョン:
1.38

詳細

grep.php file is a maintenance script that searches the source text of pages for lines matching a given regex, and prints the matching lines to stdout.

This script first fetches all page titles from the database, optionally filtering them by namespace or prefix, and then fetches their text contents to check for the given PCRE regular expression, printing the matching lines.

オプション/引数

オプション/引数 説明 必須かどうか
regex The regex to search for. 必須
--prefix Title prefix. Can be specified more than once. Use e.g. --prefix=Talk: to search an entire namespace. 省略可能
--show-wiki
-l
Add the wiki ID to the output 省略可能
--pages-with-matches Suppress normal output; instead print the title of each page from which output would normally have been printed. 省略可能

使用法

php maintenance/grep.php <regexp> [ --prefix | --show-wiki | pages-with-matches ]

The regular expression will be fed directly to preg_replace(), delimited by curly braces, except if the first character is /, in which case you are expected to add the end delimiter. This allows providing a regular expression modifier after the end delimiter.

便利なリンク