<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://deeptech.wiki/index.php?action=history&amp;feed=atom&amp;title=Module_talk%3AString</id>
	<title>Module talk:String - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://deeptech.wiki/index.php?action=history&amp;feed=atom&amp;title=Module_talk%3AString"/>
	<link rel="alternate" type="text/html" href="https://deeptech.wiki/index.php?title=Module_talk:String&amp;action=history"/>
	<updated>2026-05-08T21:57:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://deeptech.wiki/index.php?title=Module_talk:String&amp;diff=2125&amp;oldid=prev</id>
		<title>C: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://deeptech.wiki/index.php?title=Module_talk:String&amp;diff=2125&amp;oldid=prev"/>
		<updated>2025-11-15T01:19:18Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:19, 15 November 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>C</name></author>
	</entry>
	<entry>
		<id>https://deeptech.wiki/index.php?title=Module_talk:String&amp;diff=2124&amp;oldid=prev</id>
		<title>w&gt;Anomie: /* How to search for vertical bar */ Reply</title>
		<link rel="alternate" type="text/html" href="https://deeptech.wiki/index.php?title=Module_talk:String&amp;diff=2124&amp;oldid=prev"/>
		<updated>2025-10-09T00:00:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;How to search for vertical bar: &lt;/span&gt; Reply&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Old TfD|date= 2020 May 8 |result=no consensus |merge=Module:HTMLDecode |disc=Module:HTMLDecode}}&lt;br /&gt;
{{copied|from=Module:String|from_oldid=552254999|to=:incubator:Module:Wp/nod/String|to_diff=4299113}}&lt;br /&gt;
{{User:HBC Archive Indexerbot/OptIn|target=/Archive index|mask=/Archive &amp;lt;#&amp;gt;|leading_zeros=0|indexhere=yes}}&lt;br /&gt;
{{archives|banner=yes|age=90|bot=lowercase sigmabot III}}{{User:MiszaBot/config&lt;br /&gt;
| algo=old(90d)&lt;br /&gt;
| archive=Module talk:String/Archive %(counter)d&lt;br /&gt;
| counter=2&lt;br /&gt;
| maxarchivesize=100K&lt;br /&gt;
| archiveheader={{Automatic archive navigator}}&lt;br /&gt;
| minthreadsleft=5&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Protected edit request on 25 October 2023 ==&lt;br /&gt;
&lt;br /&gt;
{{edit fully-protected|Module:String|answered=yes}}&lt;br /&gt;
Please, add &amp;#039;&amp;#039;&amp;#039;r&amp;#039;&amp;#039;&amp;#039; to the word &amp;#039;&amp;#039;&amp;#039;fist&amp;#039;&amp;#039;&amp;#039; (resulting in &amp;#039;&amp;#039;fi&amp;#039;&amp;#039;&amp;#039;r&amp;#039;&amp;#039;&amp;#039;st&amp;#039;&amp;#039;), line number 61. [[User:Gkiyoshinishimoto|Nishimoto, Gilberto Kiyoshi]] ([[User talk:Gkiyoshinishimoto|talk]]) 18:11, 25 October 2023 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Protected edit request on 3 September 2024 ==&lt;br /&gt;
&lt;br /&gt;
{{edit template-protected|answered=yes}}&lt;br /&gt;
&lt;br /&gt;
All of the Lua pseudo-regex special characters are in the ASCII range. See [[:en:UTF-8#Encoding]]. Therefore, we don&amp;#039;t need at all to use the (costly) &amp;lt;code&amp;gt;mw.ustring.*&amp;lt;/code&amp;gt; functions in some parts I have reviewed.&lt;br /&gt;
&lt;br /&gt;
My request is to replace:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function str._escapePattern( pattern_str )&lt;br /&gt;
	return mw.ustring.gsub( pattern_str, &amp;quot;([%(%)%.%%%+%-%*%?%[%^%$%]])&amp;quot;, &amp;quot;%%%1&amp;quot; )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function str._escapePattern( pattern_str )&lt;br /&gt;
	return ( string.gsub( pattern_str, &amp;quot;[%(%)%.%%%+%-%*%?%[%^%$%]]&amp;quot;, &amp;quot;%%%0&amp;quot; ) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(I am also removing the capture group, which is unneeded as we can use the &amp;quot;%0&amp;quot; whole capture)&lt;br /&gt;
&lt;br /&gt;
(&amp;#039;&amp;#039;&amp;#039;edit:&amp;#039;&amp;#039;&amp;#039; I am also taking the opportunity, for extra robustness, to add parentheses in order to discard the 2nd value (number of replacements) returned by these gsub() functions, then subsequently by _escapePattern(). The more I encounter this &amp;quot;multiple values returned&amp;quot; Lua feature, the more I think it was a terrible design idea)&lt;br /&gt;
&lt;br /&gt;
Second change: line 409, we can similarly replace: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
replace = mw.ustring.gsub( replace, &amp;quot;%%&amp;quot;, &amp;quot;%%%%&amp;quot; ) --Only need to escape replacement sequences.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
replace = string.gsub( replace, &amp;quot;%%&amp;quot;, &amp;quot;%%%%&amp;quot; ) --Only need to escape replacement sequences.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These changes would significantly decrease the overhead of having the &amp;quot;plain mode&amp;quot; enabled in this module&amp;#039;s functions.&lt;br /&gt;
&lt;br /&gt;
[[User:Od1n|Od1n]] ([[User talk:Od1n|talk]]) 03:26, 3 September 2024 (UTC)&lt;br /&gt;
:[{{fullurl:Module:String|diff=prev&amp;amp;oldid=1243840019}} 1243840019], thanks. [[User:Od1n|Od1n]] ([[User talk:Od1n|talk]]) 22:38, 3 September 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Protected edit request on 18 October 2024 ==&lt;br /&gt;
&lt;br /&gt;
{{edit fully-protected|Module:String|answered=yes}}&lt;br /&gt;
The value returned by a module function must always be a string, however some functions here return numbers (these are &amp;lt;code&amp;gt;[[Module:String#len|len]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[[Module:String#str_find|str_find]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[[Module:String#find|find]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Module:String#count|count]]&amp;lt;/code&amp;gt;). Could you please apply [[Special:Diff/1251805774/1251806211|this diff]]? You can just copy and paste the code at [[Special:PermanentLink/1251806211|this permanent link]].&lt;br /&gt;
&lt;br /&gt;
Although unnoticeable when used in normal wikitext, this can create problems when [[Module:String]] is invoked using other modules.&lt;br /&gt;
&lt;br /&gt;
For instance, focusing on the &amp;lt;code&amp;gt;[[Module:String#len|len]]&amp;lt;/code&amp;gt; function, for each argument passed, a template named &amp;lt;code&amp;gt;mytemplate&amp;lt;/code&amp;gt; containing the following code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{#invoke:params|mapping_by_invoking|string|len|mapping_by_replacing|^.*$|%0 mod 3|1|for_each|[$#:$@]}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should print &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; inline&amp;gt;[PARAMETER-NAME:LENGTH-OF-PARAMETER mod 3]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code above invokes &amp;lt;code&amp;gt;{{mfl|string|len|...}}&amp;lt;/code&amp;gt; for each parameter passed. Then it attempts to replace the lengths saved with &amp;lt;code&amp;gt;%0 mod 3&amp;lt;/code&amp;gt;, i.e. by adding &amp;lt;code&amp;gt;&amp;amp;nbsp;mod 3&amp;lt;/code&amp;gt; at the end of each parameter. And so, for instance, &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; inline&amp;gt;{{mytemplate|hello|world|foo|bar}}&amp;lt;/syntaxhighlight&amp;gt; should print&lt;br /&gt;
&lt;br /&gt;
: [1:5 mod 3][2:5 mod 3][3:3 mod 3][4:3 mod 3]&lt;br /&gt;
&lt;br /&gt;
However, since &amp;lt;code&amp;gt;{{mfl|string|len|...}}&amp;lt;/code&amp;gt; returns a number, any attempt to do string manipulation with the number returned will generate an error. --[[User:Grufo|Grufo]] ([[User talk:Grufo|talk]]) 05:17, 18 October 2024 (UTC)&lt;br /&gt;
: {{not done}}:&amp;lt;!-- Template:ESp --&amp;gt; {{tq|q=y|The value returned by a module function must always be a string}} is not true. [[mw:Extension:Scribunto/Lua reference manual#Returning text]] states {{tq|The module function should usually return a single string; whatever values are returned will be passed through tostring() and then concatenated with no separator.}} Further, when calling a module function from other Lua code even that doesn&amp;#039;t apply; in that case it&amp;#039;s like any other Lua function. I also note this change may well break other code that calls these functions (if it for some reason calls functions from this module instead of calling Scribunto&amp;#039;s string manipulation functions directly) that expect a number from &amp;lt;code&amp;gt;len&amp;lt;/code&amp;gt; or the like. [[User:Anomie|Anomie]][[User talk:Anomie|⚔]] 11:12, 18 October 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Alright, it seems then that I will have to fix that in {{mfl|params|mapping_by_invoking}} and stringify whatever modules may return. --[[User:Grufo|Grufo]] ([[User talk:Grufo|talk]]) 13:35, 18 October 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Bug in &amp;lt;code&amp;gt;replace&amp;lt;/code&amp;gt;: empty strings are not recognized ==&lt;br /&gt;
Hi. I noticed that the &amp;lt;code&amp;gt;[[Module:String#replace|replace]]&amp;lt;/code&amp;gt; function is unable to recognize empty strings (see third example):&lt;br /&gt;
# &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; inline&amp;gt;{{#invoke:string|replace|Foo|^.*$|Hello|1|false}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#: ↳ {{#invoke:string|replace|Foo|^.*$|Hello|1|false}}&lt;br /&gt;
# &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; inline&amp;gt;{{#invoke:string|replace|Bar|^.*$|Hello|1|false}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#: ↳ {{#invoke:string|replace|Bar|^.*$|Hello|1|false}}&lt;br /&gt;
# &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; inline&amp;gt;{{#invoke:string|replace||^.*$|Hello|1|false}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#: ↳ {{#invoke:string|replace||^.*$|Hello|1|false}}&lt;br /&gt;
--[[User:Grufo|Grufo]] ([[User talk:Grufo|talk]]) 10:47, 12 July 2025 (UTC)&lt;br /&gt;
:Because of [[Module:String#L-402--L-404|lines 402–404]].  The reasoning for that code is not, so far as I can tell, documented.  There is similar code, also not documented, in &amp;lt;code&amp;gt;find()&amp;lt;/code&amp;gt; but that code makes some sort of sense – find anything in an empty string should return &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.  Makes me wonder if &amp;lt;code&amp;gt;replace()&amp;lt;/code&amp;gt; was created after &amp;lt;code&amp;gt;find()&amp;lt;/code&amp;gt; and used &amp;lt;code&amp;gt;find()&amp;lt;/code&amp;gt; as an armature upon which to construct &amp;lt;code&amp;gt;replace()&amp;lt;/code&amp;gt;.  Seems to me that [[Module:String#L-402|line 402]] could be rewritten as: &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; inline=&amp;quot;1&amp;quot;&amp;gt;if &amp;#039;&amp;#039; == pattern then&amp;lt;/syntaxhighlight&amp;gt;.  But, are there any templates out there that rely on this anomaly?&lt;br /&gt;
:—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 13:24, 12 July 2025 (UTC)&lt;br /&gt;
::Function &amp;lt;code&amp;gt;replace()&amp;lt;/code&amp;gt; [[Special:Diff/540121093|was added on 24 February 2013]], two days after [[Special:Diff/539690696|function &amp;lt;code&amp;gt;find()&amp;lt;/code&amp;gt; was added]]. The early return in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;if source_str == &amp;#039;&amp;#039; or pattern == &amp;#039;&amp;#039; [...]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; was added in between those edits: [[Special:Diff/540073010]]. —⁠[[User:Andrybak|andrybak]] ([[User talk:Andrybak|talk]]) 14:10, 12 July 2025 (UTC)&lt;br /&gt;
:::With some work (&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:string|replace|2=^.*$|3=Hello|4=1|5=false}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;), it is possible for there to be no parameter 1. I don&amp;#039;t know what &amp;lt;code&amp;gt;_getParameters&amp;lt;/code&amp;gt; would do with that but the code in &amp;lt;code&amp;gt;str.replace&amp;lt;/code&amp;gt; should handle a situation where parameter 1 is nil. For convenience, the code treats nil and empty as the same and that might be part of the reasoning for returning an empty string. I agree that &amp;lt;code&amp;gt;^.*$&amp;lt;/code&amp;gt; should match an empty string although, as mentioned above, it is possible that someone has taken advantage of this undocumented behavior. {{ping|WOSlinker}} Any thoughts? [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 04:37, 13 July 2025 (UTC)&lt;br /&gt;
::::Yes, I think I must have just copied find and updated the code to do replace. There only seems to be [https://en.wikipedia.org/w/index.php?title=Special:Search&amp;amp;limit=50&amp;amp;offset=0&amp;amp;ns0=1&amp;amp;ns1=1&amp;amp;ns2=1&amp;amp;ns3=1&amp;amp;ns4=1&amp;amp;ns5=1&amp;amp;ns6=1&amp;amp;ns7=1&amp;amp;ns8=1&amp;amp;ns9=1&amp;amp;ns10=1&amp;amp;ns11=1&amp;amp;ns12=1&amp;amp;ns13=1&amp;amp;ns14=1&amp;amp;ns15=1&amp;amp;ns100=1&amp;amp;ns101=1&amp;amp;ns118=1&amp;amp;ns119=1&amp;amp;ns828=1&amp;amp;ns829=1&amp;amp;search=insource%3A%2F%5C%5E%5C.%5C%2A%5C%24%2F 24 occurences] of &amp;lt;code&amp;gt;^.*$&amp;lt;/code&amp;gt; so won&amp;#039;t take long to check if the undocumented behaviour is used. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 07:39, 13 July 2025 (UTC)&lt;br /&gt;
:::::@[[User:WOSlinker|WOSlinker]]: Unfortunately there are an arbitrary number of patterns that can match an empty string, e.g., {{code|^X*$}}, {{code|X*}}, {{code|X?}} and of course an empty string will match another empty string, etc. There are certainly better ways to replace empty strings with nonempty ones but the logic is valid. The suggestion [[User:Trappist the monk|Trappist the monk]] made is not the right solution either because it ignores the {{code|replace}} text. Instead change the {{code|lang=lua|or}} to an {{code|lang=lua|and}} and change the return from {{code|source_str}} to {{code|replace}}. In fact, another optimization would be: inside {{code|lang=lua|if plain then}} add {{code|lang=lua|1=if pattern == source_str then return replace end}}. —[[User:Uzume|Uzume]] ([[User talk:Uzume|talk]]) 19:16, 16 July 2025 (UTC)&lt;br /&gt;
:::::: {{Re|Trappist the monk|⁠andrybak|Johnuniq|WOSlinker|Uzume}} Any updates on this? --[[User:Grufo|Grufo]] ([[User talk:Grufo|talk]]) 12:49, 27 July 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== How to search for vertical bar ==&lt;br /&gt;
&lt;br /&gt;
I am having trouble searching for [[vertical bar]] (&amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;) i.e., U+007C; &amp;lt;code&amp;gt;&amp;amp;amp;vert;&amp;lt;/code&amp;gt;. (My RW app: find {{kbd|{{!}}-}} in tables to identify the beginning of a table row.) Here are some tests trying to match {{kbd|c{{!}}d}} in a string containing &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;abc|def&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; that do not work, but I&amp;#039;m not sure how to specify the vertical bar either in the pattern. (Or, for that matter, in the string in the tests below; note that some of these use &amp;amp;amp;vert; or &amp;amp;amp;#124; although they render as vbar even embedded in nowikis, so what appear to be duplicate tests below are actually different):&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s=abc{{!}}def  |pattern=c&amp;amp;vert;d |plain=false |nomatch=0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s=abc{{!}}def  |pattern=c&amp;amp;vert;d |plain=false |nomatch=0}}&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s=abc{{!}}def  |pattern=c&amp;amp;#124;d |plain=false |nomatch=0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s=abc{{!}}def  |pattern=c&amp;amp;#124;d |plain=false |nomatch=0}}&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s=abc{{!}}def  |pattern=c\|d     |plain=false |nomatch=0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s=abc{{!}}def  |pattern=c\|d     |plain=false |nomatch=0}}&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s=abc&amp;amp;vert;def |pattern=c{{!}}d  |plain=false |nomatch=0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s=abc&amp;amp;vert;def |pattern=c{{!}}d  |plain=false |nomatch=0}}&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s=abc&amp;amp;#124;def |pattern=c\|d     |plain=false |nomatch=0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s=abc&amp;amp;#124;def |pattern=c\|d     |plain=false |nomatch=0}}&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s=abc\|def     |pattern=c\|d     |plain=false |nomatch=0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s=abc\|def     |pattern=c\|d     |plain=false |nomatch=0}}&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s=abc|def      |pattern=c\|d     |plain=false |nomatch=0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s=abc|def      |pattern=c\|d     |plain=false |nomatch=0}}&lt;br /&gt;
&lt;br /&gt;
According to [[mw:LUAREF#Character class]], &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt; just represents itself, because it is not one of &amp;lt;code&amp;gt;^$()%.[]*+-?)&amp;lt;/code&amp;gt;, but you can&amp;#039;t place it into a pattern in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|...}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; because the invocation will treat it as a param separator. So, how do I search for it using string match, or in any of the other string functions that take patterns? &lt;br /&gt;
&lt;br /&gt;
Using transcluded file [[/vbar test data]], I was able to do it, thus:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s={{/vbar test data}}|pattern=[a-z]{{!}}[a-z] |plain=false}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s={{/vbar test data}}|pattern=[a-z]{{!}}[a-z] |plain=false}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|match|s={{/vbar test data}}|pattern=[a-z]{{!}}[a-z] |plain=false |match=2}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; ⟶ {{#invoke:String|match|s={{/vbar test data}}|pattern=[a-z]{{!}}[a-z] |plain=false |match=2}}&lt;br /&gt;
But I wasn&amp;#039;t able to do it inline without transcluding a file. Is there a way? [[User:Mathglot|Mathglot]] ([[User talk:Mathglot|talk]]) 22:01, 6 October 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
: @[[User:Mathglot|Mathglot]]: These two solutions&lt;br /&gt;
: #1&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{#invoke:string | match&lt;br /&gt;
	| s = abc{{!}}def&lt;br /&gt;
	| pattern = c{{!}}d &lt;br /&gt;
	| plain = false &lt;br /&gt;
	| nomatch = 0&lt;br /&gt;
}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
: #2&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{#invoke:string | match&lt;br /&gt;
	| s = abc{{!}}def&lt;br /&gt;
	| pattern = c{{!}}d &lt;br /&gt;
	| plain = true &lt;br /&gt;
	| nomatch = 0&lt;br /&gt;
}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
: yield:&lt;br /&gt;
:: {{#invoke:string | match&lt;br /&gt;
	| s = abc{{!}}def&lt;br /&gt;
	| pattern = c{{!}}d &lt;br /&gt;
	| plain = false &lt;br /&gt;
	| nomatch = 0&lt;br /&gt;
}}&lt;br /&gt;
: and&lt;br /&gt;
:: {{#invoke:string | match&lt;br /&gt;
	| s = abc{{!}}def&lt;br /&gt;
	| pattern = c{{!}}d &lt;br /&gt;
	| plain = true &lt;br /&gt;
	| nomatch = 0&lt;br /&gt;
}}&lt;br /&gt;
: Since you don&amp;#039;t use Lua patterns, I suggest you use the second one (i.e. {{tjp2|plain|true}}). P.S. Template calls, parser functions and module invocations are expanded before parameters are passed; so if you write &amp;lt;code&amp;gt;{{mwl|!}}&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;match&amp;lt;/code&amp;gt; function will simply receive &amp;lt;code&amp;gt;&amp;amp;#124;&amp;lt;/code&amp;gt; and will have no idea you ever called a parser function. --[[User:Grufo|Grufo]] ([[User talk:Grufo|talk]]) 22:35, 6 October 2025 (UTC)&lt;br /&gt;
:: Thank you for this. Actually, your top version was my initial attempt and got a match, but I couldn&amp;#039;t tell what was being matched (i.e., the curlies and all match, but not what I was seeking) so I didn&amp;#039;t think that was valid. But given your explanation, it sounds like it is a valid match, so that&amp;#039;s good to know. I will actually be using Lua patterns; these are simplified examples for the question. Thanks again! [[User:Mathglot|Mathglot]] ([[User talk:Mathglot|talk]]) 22:50, 6 October 2025 (UTC)&lt;br /&gt;
::: @[[User:Mathglot|Mathglot]]: I am glad it helped. An important exception to the expansion order happens in substitutions. If you write,&lt;br /&gt;
::: &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{subst:#invoke:string | match&lt;br /&gt;
	| s = abc{{!}}def&lt;br /&gt;
	| pattern = c{{!}}d &lt;br /&gt;
	| plain = true &lt;br /&gt;
	| nomatch = 0&lt;br /&gt;
}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
::: you will still get a match, but the &amp;lt;code&amp;gt;match&amp;lt;/code&amp;gt; function will actually receive &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; inline&amp;gt;{{!}}&amp;lt;/syntaxhighlight&amp;gt; instead of &amp;lt;code&amp;gt;&amp;amp;#124;&amp;lt;/code&amp;gt; (this is because substitutions are expanded before transclusions). And so, to pass &amp;lt;code&amp;gt;&amp;amp;#124;&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;match&amp;lt;/code&amp;gt; function in substitutions you will have to write:&lt;br /&gt;
::: &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot;&amp;gt;{{subst:#invoke:string | match&lt;br /&gt;
	| s = abc{{subst:!}}def&lt;br /&gt;
	| pattern = c{{subst:!}}d &lt;br /&gt;
	| plain = true &lt;br /&gt;
	| nomatch = 0&lt;br /&gt;
}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
::: --[[User:Grufo|Grufo]] ([[User talk:Grufo|talk]]) 16:24, 8 October 2025 (UTC)&lt;br /&gt;
:::: Wow, thanks for that. The core of both of your responses here should be added somewhere at [[mw:Extension:Scribunto/Lua reference manual]], as I looked all over and couldn&amp;#039;t find anything like this about vertical bar. [[User:Mathglot|Mathglot]] ([[User talk:Mathglot|talk]]) 16:40, 8 October 2025 (UTC)&lt;br /&gt;
:::::That&amp;#039;s probably because the documentation considers Lua code mostly from the perspective of Lua, rather than trying to detail all the idiosyncrasies of MediaWiki&amp;#039;s wikitext processing before the arguments get passed into Lua. [[User:Anomie|Anomie]][[User talk:Anomie|⚔]] 00:00, 9 October 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>w&gt;Anomie</name></author>
	</entry>
</feed>