https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AStr_find_word%2Fsandbox%2Fdoc
Module:Str find word/sandbox/doc - Revision history
2025-06-06T19:47:31Z
Revision history for this page on the wiki
MediaWiki 1.45.0-wmf.4
https://en.wikipedia.org/w/index.php?title=Module:Str_find_word/sandbox/doc&diff=1145830675&oldid=prev
DePiep: does not work as ecpected / biut keeps being linked to by module v-t-e. so.
2023-03-21T06:45:14Z
<p>does not work as ecpected / biut keeps being linked to by module v-t-e. so.</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 06:45, 21 March 2023</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">test</del> [[<del style="font-weight: bold; text-decoration: none;">:</del>Module:Str find word<del style="font-weight: bold; text-decoration: none;">/sandbox</del>/doc]]</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">#REDIRECT</ins> [[Module:Str find word/doc]]</div></td>
</tr>
</table>
DePiep
https://en.wikipedia.org/w/index.php?title=Module:Str_find_word/sandbox/doc&diff=1145825607&oldid=prev
DePiep at 05:55, 21 March 2023
2023-03-21T05:55:53Z
<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 05:55, 21 March 2023</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>test [[:Module:Str find word/sandbox/doc]]</div></td>
</tr>
</table>
DePiep
https://en.wikipedia.org/w/index.php?title=Module:Str_find_word/sandbox/doc&diff=1145529316&oldid=prev
DePiep: ←Blanked the page
2023-03-19T16:39:11Z
<p><a href="/wiki/Wikipedia:AES" class="mw-redirect" title="Wikipedia:AES">←</a>Blanked the page</p>
<a href="//en.wikipedia.org/w/index.php?title=Module:Str_find_word/sandbox/doc&diff=1145529316&oldid=1145529238">Show changes</a>
DePiep
https://en.wikipedia.org/w/index.php?title=Module:Str_find_word/sandbox/doc&diff=1145529238&oldid=prev
DePiep at 16:38, 19 March 2023
2023-03-19T16:38:45Z
<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 16:38, 19 March 2023</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Str find word/sandbox/doc</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{sandbox other|1=|2={{Module rating|pre-alpha}}}}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{sandbox other|1=|2={{Module rating|pre-alpha}}}}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>:TOC: [[#code]] ({{edit|Module:Str find word/sandbox}})</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>:TOC: [[#code]] ({{edit|Module:Str find word/sandbox}})</div></td>
</tr>
</table>
DePiep
https://en.wikipedia.org/w/index.php?title=Module:Str_find_word/sandbox/doc&diff=1145528257&oldid=prev
DePiep at 16:32, 19 March 2023
2023-03-19T16:32:03Z
<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 16:32, 19 March 2023</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>{{Module rating|pre-alpha}}</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">{{sandbox other|1=|2=</ins>{{Module rating|pre-alpha<ins style="font-weight: bold; text-decoration: none;">}}</ins>}}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>:TOC: [[#code]] ({{edit|Module:Str find word/sandbox}})</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>:TOC: [[#code]] ({{edit|Module:Str find word/sandbox}})</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
</table>
DePiep
https://en.wikipedia.org/w/index.php?title=Module:Str_find_word/sandbox/doc&diff=1145523231&oldid=prev
DePiep: ←Created page with '{{Module rating|pre-alpha}} :TOC: #code ({{edit|Module:Str find word/sandbox}}) {{Module:Str find word/links/doc}} {{Lua|Module:Yesno|Module:TableTools|Module:String}} This module looks for a word being present in a comma-separated list of words. It then returns a {{code|True}} or {{code|False}} value. By default, the True-value returned is the found word itself; the False-value is a blank string. Implements {{tl|Str find word}}. For example, in the...'
2023-03-19T15:57:06Z
<p><a href="/wiki/Wikipedia:AES" class="mw-redirect" title="Wikipedia:AES">←</a>Created page with '{{Module rating|pre-alpha}} :TOC: <a href="#code">#code</a> ({{edit|Module:Str find word/sandbox}}) {{Module:Str find word/links/doc}} {{Lua|Module:Yesno|Module:TableTools|Module:String}} This module looks for a word being present in a comma-separated list of words. It then returns a {{code|True}} or {{code|False}} value. By default, the True-value returned is the found word itself; the False-value is a blank string. Implements {{tl|Str find word}}. For example, in the...'</p>
<p><b>New page</b></p><div>{{Module rating|pre-alpha}}<br />
:TOC: [[#code]] ({{edit|Module:Str find word/sandbox}})<br />
<br />
{{Module:Str find word/links/doc}}<br />
<br />
{{Lua|Module:Yesno|Module:TableTools|Module:String}}<br />
This module looks for a word being present in a comma-separated list of words. It then returns a {{code|True}} or {{code|False}} value.<br />
By default, the True-value returned is the found word itself; the False-value is a blank string. Implements {{tl|Str find word}}.<br />
<br />
For example, in the source string '{{mono|1=foo, bar}}' the word '{{mono|1=bar}}' appears, but the word '{{mono|1=november}}' does not.<br />
:True: <code><nowiki>{{#invoke:Str find word|main |source=foo, bar|word=bar}}</nowiki></code> &rarr; >{{#invoke:Str find word|main |source=foo, bar|word=bar}}<<br />
:False: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma|word=november}}</nowiki></code> &rarr; >{{#invoke:Str find word|main |source=alpha, beta, gamma|word=november}}<<br />
<br />
Complete words: the complete word is '{{mono|1=foobar}}' ... example needed ...<br />
<br />
''Multiple word check'': The search can be extended to check for multiple words being present.<br />
<br />
''AND''-list of words, all words must be present:<br />
:True: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma|andwords=beta, alpha}}</nowiki></code> &rarr; >{{#invoke:Str find word|main |source=alpha, beta, gamma|andwords=beta, alpha}}<<br />
:False: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma|andwords=beta, omega}}</nowiki></code> &rarr; >{{#invoke:Str find word|main |source=alpha, beta, gamma|andwords=beta, omega}}<<br />
<br />
''OR''-list of words, at least one off the words must be present:<br />
:True: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma|orwords=beta, alpha}}</nowiki></code> &rarr; >{{#invoke:Str find word|main |source=alpha, beta, gamma|orwords=beta, alpha}}<<br />
:False: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma|orwords=beta, omega}}</nowiki></code> &rarr; >{{#invoke:Str find word|main |source=alpha, beta, gamma|orwords=beta, omega}}<<br />
<br />
The module is aimed at template code usage. <small>(The editor does not have to apply Lua patterns like {{code|1=[%a%d]*}})</small>.<br />
==Parameters==<br />
:All parameters (synonyms)<br />
{|<br />
|-<br />
|<pre><br />
{{Str find word<br />
|string = <br />
|word =<br />
|orwords = <br />
|case=<br />
|yes =<br />
|no =<br />
|explain =<br />
}}<br />
</pre><br />
|<pre><br />
{{Str find word<br />
|s = <br />
|w =<br />
|orw =<br />
|case=<br />
|yes =<br />
|no =<br />
|explain =<br />
}}<br />
</pre><br />
|<pre><br />
{{Str find word<br />
|s= source= <br />
|word= andwords= andw=<br />
|orwords= orw=<br />
|case=<br />
|yes=<br />
|no=<br />
|explain=<br />
<!-- |sep=todo --><br />
}}<br />
</pre><br />
|}<br />
<pre>{{Str find word |s= |w= |andw= |orw= |case= |yes= |no= |explain=}}</pre><br />
<br />
===Basic: source, word===<br />
<pre><br />
{{Str find word<br />
|source =<br />
|word =<br />
}}<br />
</pre><br />
<br />
:When the ''word'' is found in the ''source'' (True), the function returns the ''word'' itself (by default), or {{para|yes}} value (when entered non-empty).<br />
:When not found (False), the function returns a empty string ({{code|''}}), or the {{para|no}} value when entered.<br />
<br />
{| class="wikitable"<br />
|-<br />
| {{para|1=source|2=alpha, foo, lima}}<br />
| {{para|word|foo}}<br />
| {{#invoke:Str find word|main |explain=true |source=alpha, foo, lima|word=foo}}<br />
| {{aye}}<br />
| <br />
|-<br />
| {{para|1=source|2=alpha, foo, lima}}<br />
| {{para|word|bar}}<br />
| {{#invoke:Str find word|main |explain=true |source=alpha, foo, lima|word=foo-bar}}<br />
| {{nay}}<br />
| full word ''bar'' not in the source<br />
|-<br />
| {{para|1=source|2=alpha, foo, lima}}<br />
| {{para|word|foobar}}<br />
| {{#invoke:Str find word|main |explain=true |source=alpha, foo, lima}}<br />
| {{nay}}<br />
| word ''foobar'' not in the source as full word<br />
|}<br />
<br />
===Case, Literal, ===<br />
: todo: examplify<br />
{| class="wikitable" style=""<br />
|-<br />
! {{para|1=source}}<br/> {{para|1=s}}<br />
! {{para|1=word}}<br/>{{para|1=w}}<br />
! {{para|1=case}}<br />
! result<br />
! note<br />
|-<br />
| {{para|1=s|2=alpha, foo, lima}}<br />
| {{para|w|foo}}<br />
|<br />
| &rarr; {{#invoke:Str find word|main |explain=true |s=alpha, foo, lima|w=foo|yes=yes|no=no}}<br />
| <br />
|-<br />
| {{para|1=s|2=alpha, foo, lima}}<br />
| {{para|w|foobar}}<br />
|<br />
| &rarr; {{#invoke:Str find word|main |explain=true |source=alpha, foo, lima|word=foobar|yes=yes|no=no}}<br />
| <br />
|-<br />
| {{para|1=s|2=alpha, foobar, lima}}<br />
| {{para|w|foo}}<br />
|<br />
| &rarr; {{#invoke:Str find word|main |explain=true |source=alpha, foobar, lima|word=foo|yes=yes|no=no}}<br />
| 'foo' is not the complete word<br />
|-<br />
| {{para|1=s|2=alpha, FOO, lima}}<br />
| {{para|w|foo}}<br />
|<br />
| &rarr; {{#invoke:Str find word|main |explain=true |source=alpha, FOO, lima|word=foo|yes=yes|no=no|case=false}}<br />
| {{para|case|false}}: a=A ''(default)''<br />
|-<br />
| {{para|1=s|2=alpha, FOO, lima}}<br />
| {{para|w|foo}}<br />
|<br />
| &rarr; {{#invoke:Str find word|main |explain=true |source=alpha, FOO, lima|word=foo|yes=yes|no=no|case=true}}<br />
| {{para|case|true}}: a=/=A<br />
|}<br />
<br />
===AND-, OR-wordlist checks===<br />
:{{para|word}} as noted, can be a ''list of words''. All will be checked with the ''AND''-requirement (each word must be present).<br />
:{{para|andwords}} accepts a ''list of words'' that all will be checked with the ''AND''-requirement (each word must be present).<br />
::When both {{para|word}}, {{para|andwords}} are present, they are combined into one single ''AND''-wordlist.<br />
:{{para|orwords}} accepts a ''list of words'' that all will be checked with the ''OR''-requirement (at least one of the words must be present).<br />
<br />
{| class="wikitable" style=""<br />
|-<br />
! {{para|1=source}}<br/>{{para|1=s}}<br />
! {{para|1=andwords}}, {{para|1=andw}}<br/>{{para|1=word}}<br/>{{para|1=w}}<br />
! {{para|1=orwords}}<br/>{{para|1=orw}}<br />
! result TODO fix<br />
! note<br />
|-<br />
| {{para|1=s|2=alpha, foo, lima, delta}}<br />
| {{para|andw|delta, lima}}<br />
|<br />
| {{#invoke:Str find word|main |explain=true |s=alpha, foo, lima, delta|andw=delta, lima}}<br />
| both words present in the source<br />
|-<br />
| {{para|1=s|2=alpha, foo, lima, delta}}<br />
| {{para|andw|foo, nov}}<br />
|<br />
| {{#invoke:Str find word|main |explain=true |s=alpha, foo, lima, delta}}<br />
| AND-logic: A word in the ''AND''-list is not present ({{mono|nov}}), so false<br />
|-<br />
| {{para|1=s|2=alpha, foo, lima, delta}}<br />
| {{para|andw|delta}}<br />
|<br />
| {{#invoke:Str find word|main |explain=true |s=alpha, foo, lima, delta|andw=delta}}<br />
| {{para|w}} and {{para|andw}} are combined<br />
<br />
|-<br />
| {{para|1=s|2=alpha, foo, lima, delta}}<br />
|<br />
| {{para|orw|delta, lima}}<br />
| {{#invoke:Str find word|main |explain=true |s=alpha, foo, lima, delta|orw=delta, lima}}<br />
| both OR-words are present in the source<br />
|-<br />
| {{para|1=s|2=alpha, foo, lima, delta}}<br />
|<br />
|<br />
| {{#invoke:Str find word|main |explain=true |s=alpha, foo, lima, delta|orw=foo, nov}}<br />
| OR-logic: one of the words is present ({{para|foo}}), so true<br />
|-<br />
| {{para|1=s|2=alpha, foo, lima, delta}}<br />
| {{para|andw|alpha, lima}}<br />
| {{para|orw|foo, nov}}<br />
| {{#invoke:Str find word|main |explain=true |s=alpha, foo, lima, delta|andw=alpha, lima|orw=foo, nov}}<br />
| <br />
|-<br />
| {{para|1=s|2=alpha, foo, lima, delta}}<br />
| {{para|andw|bar, april}}<br />
| {{para|orw|nov, dec}}<br />
| {{#invoke:Str find word|main |explain=true |s=alpha, foo, lima, delta|andw=delta|orw=nov, dec}}<br />
| none of the OR-words is present, so false<br />
|}<br />
<br />
===True, False rephrase options {{para|yes, no}}===<br />
{| class="wikitable"<br />
|-<br />
! colspan="5" style="padding-left:3em; text-align:left;" | {{code|1=...}} {{para|yes|Yes, hit}} {{para|no|Not found}}<br />
|-<br />
| {{para|1=source|2=alpha, foo, lima}}<br />
| {{para|word|foo}}<br />
| {{#invoke:Str find word|main |explain=true |source=alpha, foo, lima|word=foo|yes=Yes, hit|no=No, not found}}<br />
| {{aye}}<br />
|-<br />
| {{para|1=source|2=alpha, foo, lima}}<br />
| {{para|word|foobar}}<br />
| {{#invoke:Str find word|main |explain=true |source=alpha, foo, lima|word=foobar|yes=Yes, hit|no=No, not found}}<br />
| {{nay}}<br />
|}<br />
<br />
===Edge cases: (blank input,) ===<br />
:''todo''<br />
<br />
==issues and ideas==<br />
* Keep the order, Foo, bar -> foo(1), bar(2)<br />
::eg table col userinput options, then cols in that order?<br />
<br />
* Check comma example above ({{code|1="Hello, world"}}) (currently returns: 2 hitwords & sep=comma Dec2022)<br />
<br />
*Make sure all boolean logic is by [[:Module:Yesno]]<br />
:''and'' resolve {{code|nil}}<br />
<br />
*option {{para|sep}} for output list >,&nbsp;< dflt<br />
<br />
* allow pattern input = recognise ({{code|150%, 175%, ..}}) so patterns again ;-)<br />
* ignore characters eg "/"?<br />
* cleanup (RLM), stated: named params only (wrt WS)<br />
* option add prefix, suffix -- when success only<br />
* list presentation..<br />
<br />
==Errors and analysis==<br />
* The logic itself does not produce errors. There is always a True of False result. <br />
<br />
* Pages with Unknown parameters are listed in {{clc|Category:Pages using str find word with unknown parameters}}.<br />
<br />
:There are no logical errors foreseen: any flaw in the input will return a False result (for example, no input strings to check were entered).<br />
<br />
* {{para|explain|true}}: when in {{button|Preview}}, display a report on input, output and the logical steps (debug).<br />
* {{para|explain|testcases}}: When set in ns {{mono|1=Template}} or {{mono|1=User}} on subpage {{mono|1=/testcases}}, the Preview report is static (shown permanently).<br />
===code===<br />
<includeonly>{{sandbox other||<br />
[[:Category:Modules that manipulate strings]]<br />
}}</includeonly></div>
DePiep