<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AStringTools</id>
	<title>Module:StringTools - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AStringTools"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:StringTools&amp;action=history"/>
	<updated>2026-04-13T19:48:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:StringTools&amp;diff=147062&amp;oldid=prev</id>
		<title>imported&gt;Erutuon: from wikt:Module:string</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:StringTools&amp;diff=147062&amp;oldid=prev"/>
		<updated>2017-09-15T05:21:43Z</updated>

		<summary type="html">&lt;p&gt;from &lt;a href=&quot;https://en.wiktionary.org/wiki/Module:string&quot; class=&quot;extiw&quot; title=&quot;wikt:Module:string&quot;&gt;wikt:Module:string&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
--[=[&lt;br /&gt;
	Similar to gmatch, but it returns the count of the match in addition to the&lt;br /&gt;
	list of captures, something like ipairs().&lt;br /&gt;
	&lt;br /&gt;
	If the pattern doesn&amp;#039;t contain any captures, the whole match is returned.&lt;br /&gt;
	&lt;br /&gt;
	Invoke thus:&lt;br /&gt;
	&lt;br /&gt;
		for i, whole_match in require(&amp;quot;Module:string&amp;quot;).imatch(text, pattern) do&lt;br /&gt;
			[ do something with i and whole_match ]&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
	or&lt;br /&gt;
	&lt;br /&gt;
		for i, capture1[, capture2[, capture3[, ...]]] in require(&amp;quot;Module:string&amp;quot;).imatch(text, pattern) do&lt;br /&gt;
			[ do something with i and capture1 ]&lt;br /&gt;
		end&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
function p.imatch(text, pattern, start, plain)&lt;br /&gt;
	local i = 0&lt;br /&gt;
	local pos = start or 0&lt;br /&gt;
	if not mw.ustring.find(pattern, &amp;quot;%b()&amp;quot;) then&lt;br /&gt;
		pattern = &amp;quot;(&amp;quot; .. pattern .. &amp;quot;)&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	return function()&lt;br /&gt;
		i = i + 1&lt;br /&gt;
		local return_values = { mw.ustring.find(text, pattern, pos, plain) }&lt;br /&gt;
		local j = return_values[2]&lt;br /&gt;
		&lt;br /&gt;
		if #return_values &amp;gt; 0 then&lt;br /&gt;
			pos = j + 1&lt;br /&gt;
			-- Skip the first two returned values, which are the indices of the&lt;br /&gt;
			-- whole match.&lt;br /&gt;
			return i, unpack(return_values, 3)&lt;br /&gt;
		else&lt;br /&gt;
			return nil, nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Erutuon</name></author>
	</entry>
</feed>