Jump to content

WikiMonitor/docs

From Meta, a Wikimedia project coordination wiki

Variables

[edit]

These variables represent properties of the recent change event. You can use them in your filter expressions.

Variable Type Description
user String Username or IP of the editor.
title String Title of the page.
comment String Edit summary/comment.
wiki String Database name of the wiki (e.g., 'enwiki').
type String Type of change ('edit', 'new', 'log', etc.).
namespace Integer Namespace ID of the page.
bot Boolean True if the edit was made by a bot.
minor Boolean True if marked as a minor edit.
added_lines String Content of lines added in this edit.
removed_lines String Content of lines removed in this edit.
user_groups List<String> List of user groups (e.g., 'sysop', 'bot').
user_rights List<String> List of user rights.
id Long Event ID.
page_id Long ID of the page.
title_url String URL of the page title.
parsedcomment String Parsed edit summary (HTML).
timestamp Long Timestamp of the edit.
patrolled Boolean True if the edit was patrolled.
notify_url String URL for notifications.
server_url String Base URL of the server.
server_name String Hostname of the server.
server_script_path String Path to the server script.
flagged Boolean Internal flag (true if flagged by filter).
abuseType String Internal abuse type classification.
user_name String Alias for 'user'.
page_namespace Integer Alias for 'namespace'.
old_size Long Size of the page before the edit.

String Functions

[edit]

contains(text, value)

[edit]

Checks if text contains value (case-sensitive).

contains(title, 'Java')

containsIgnoreCase(text, value)

[edit]

Checks if text contains value (case-insensitive).

containsIgnoreCase(comment, 'vandalism')

length(text)

[edit]

Returns the length of the string.

length(comment) > 50

normalizeArabic(text)

[edit]

Normalizes Arabic text.

contains(normalizeArabic(title), 'محمد')

startsWith(text, value)

[edit]

Checks if text starts with value.

startsWith(title, 'User:')

endsWith(text, value)

[edit]

Checks if text ends with value.

endsWith(title, '.js')

trim(text)

[edit]

Removes leading and trailing whitespace.

trim(comment)

Regex Functions

[edit]

matches(text, regex)

[edit]

Returns true if text matches the regex.

matches(title, '^User:.*')

rcount(text, regex)

[edit]

Returns the number of matches of the regex.

rcount(added_lines, 'https?://') > 5

List Functions

[edit]

in(value, list)

[edit]

Returns true if value is present in the list.

in('sysop', user_groups)

anyContains(text, list)

[edit]

Returns true if text contains any string from list.

anyContains(comment, ['bad', 'word'])

Time Functions

[edit]

hour(time)

[edit]

Returns the hour of the day (0-23).

hour(now()) == 3

dayOfWeek(time)

[edit]

Returns the day of the week.

dayOfWeek(now()) == 'MONDAY'

Examples

[edit]

You can find more examples on this page.

Detect potential vandalism (large removal of content)

[edit]
old_size > 1000 && (old_size - length(added_lines) - length(removed_lines)) > 500

Monitor specific user on specific wiki

[edit]
wiki == 'enwiki' && user == 'TargetUser'

Filter for main namespace edits by anonymous users

[edit]
namespace == 0 && matches(user, '^\d+\.\d+\.\d+\.\d+$')