m
1 revision imported
(separate annotations for str.match from those for str._match) |
m (1 revision imported) |
||
Line 107:
--[[
match▼
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}▼
OR▼
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index▼
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}▼
Parameters
Line 129 ⟶ 131:
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or▼
trailing whitespace from each string. In some circumstances this is desirable, in▼
other cases one may want to preserve the whitespace.▼
If the match_number or start_index are out of range for the string being queried, then▼
this function generates an error. An error is also generated if no match is found.▼
If one adds the parameter ignore_errors=true, then the error will be suppressed and▼
an empty string will be returned on any failure.▼
For information on constructing Lua patterns, a form of [regular expression], see:
Line 198 ⟶ 209:
end
end
▲match
▲{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
▲OR
▲{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
▲ |match=match_number|plain=plain_flag|nomatch=nomatch_output}}
▲If invoked using named parameters, Mediawiki will automatically remove any leading or
▲trailing whitespace from each string. In some circumstances this is desirable, in
▲other cases one may want to preserve the whitespace.
▲If the match_number or start_index are out of range for the string being queried, then
▲this function generates an error. An error is also generated if no match is found.
▲If one adds the parameter ignore_errors=true, then the error will be suppressed and
▲an empty string will be returned on any failure.
-- This is the entry point for #invoke:String|match
function str.match( frame )
|