Extension:RegexParserFunctions/ja

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki 拡張機能マニュアル
OOjs UI icon advanced.svg
RegexParserFunctions
リリースの状態: 安定
実装 Parser function
説明 Adds a {{#regex}} parser function for evaluating regular expressions.
作者 Jim R. Wilson (Jimbojw), Vitaliy Filippov
最新バージョン 0.1
MediaWiki 1.6-1.22 以降
ライセンス MIT ライセンス
ダウンロード https://github.com/mediawiki4intranet/RegexParserFunctions
translatewiki.net で翻訳を利用できる場合は、RegexParserFunctions 拡張機能の翻訳にご協力ください
使用状況とバージョン マトリクスを確認してください。

The RegexParserFunctions extension adds a parser function called 'regex' (or 'regexp') which is used to perform regular expression pattern matching and replacement.

The extension in unmaintained by the original author, but is now maintained by me (User:VitaliyFilippov) as a part of Mediawiki4Intranet project. The security issue found by User:Pastakhov (one with the null-byte) is fixed in our version, and the extension is compatible with latest versions of MediaWiki.

Git repository
https://github.com/mediawiki4intranet/RegexParserFunctions
New homepage
http://wiki.4intra.net/RegexParserFunctions
Old homepage
http://jimbojw.com/wiki/index.php?title=RegexParserFunctions_Extension
Licensing
RegexParserFunctions is released under The MIT License.

インストール[edit]

  1. Clone the repository from https://github.com/mediawiki4intranet/RegexParserFunctions into $IP/extensions/ subdirectory
    Note: $IP is your MediaWiki install dir.
  2. Enable the extension by adding this line to your LocalSettings.php:
    require_once("$IP/extensions/RegexParserFunctions/RegexParserFunctions.php");
    

使用法[edit]

Once installed, editors of your wiki can evaluate regular expressions in one of two ways: simple match, and replacement.

  • Simple match: {{#regex: <string> | <regex>}}, evaluates to the matching portion of <string>
  • Replacement: {{#regex: <string> | <regex> | <replacement>}}, evaluates to <string> with <regex> replaced by <replacement> globally

For example, say you're trying to grab the last portion of a Title which is using '/' delimiting subpage notation. For that, you could use:

{{#regex:{{PAGENAME}}|%^.*/(.*)$%|$1}}

RegexParserFunctions を使用しているウェブサイト[edit]

関連項目[edit]


言語: English  • 日本語