Module:String/doc: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Use more helpful links to "lua-style regular expression"
(→‎count: extra examples of Scribunto patterns)
(Use more helpful links to "lua-style regular expression")
Line 122:
: In some cases it may be possible to make multiple matches on a single string. This specifies which match to return, where the first match is match= 1. If a negative number is specified then a match is returned counting from the last match. Hence match = -1 is the same as requesting the last match. Defaults to 1.
; plain
: Boolean flag indicating that pattern should be understood as plain text and not as a [[mw:Extension:Scribunto/Lua reference manual#Ustring patterns|Scribunto ustring pattern]] (a unicode-friendly [[w:en:Lua (programming language)|Lua]]-style [[w:en:regular expression|regular expression]]). Defaults to false (to change: <code>plain=true</code>)
; nomatch
: If no match is found, output the "nomatch" value rather than an error.
Line 230:
: The index within the source string to start the search, defaults to 1
; plain
: Boolean flag indicating that target should be understood as plain text and not as a [[mw:Extension:Scribunto/Lua reference manual#Ustring patterns|Scribunto ustring pattern]] (a unicode-friendly [[w:en:Lua (programming language)|Lua]]-style [[w:en:regular expression|regular expression]],); defaults to true
 
This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu