<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Template%3ARegex%2Fdoc</id>
	<title>Template:Regex/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Template%3ARegex%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Template:Regex/doc&amp;action=history"/>
	<updated>2026-05-11T05:43:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Template:Regex/doc&amp;diff=40385&amp;oldid=prev</id>
		<title>imported&gt;Frietjes: typo</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Template:Regex/doc&amp;diff=40385&amp;oldid=prev"/>
		<updated>2023-03-24T16:54:58Z</updated>

		<summary type="html">&lt;p&gt;typo&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
{{tsh|slre}}&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
This template helps field the details in the wikitext of any page on the wiki.  Normally searches ignore non-alphanumeric characters, but regular expressions (regex) accept all characters, plus metacharacters.&lt;br /&gt;
&lt;br /&gt;
This template acts as a doorway by helping to develop a database query before running it on the wiki, and it does this by way of a [[Template:Internal search templates common doc|search link]] that can also be used to share such discoveries. This template can also be used to learn the regular expression syntax of [[Special:Version#Installed software|this version]] of [[mw:Help:CirrusSearch|Cirrus Search]].  You could use a bare {{tlf|search link}} to do all this, but this template saves a lot of typing (see below), so you only need to focus on entering a regexp.&lt;br /&gt;
&lt;br /&gt;
An important alternative to using this template is performing a [[H:S|search]] directly with &amp;#039;&amp;#039;insource:&amp;#039;&amp;#039;&amp;lt;kbd&amp;gt;&amp;quot;quotes-delimited arguments&amp;quot;&amp;lt;/kbd&amp;gt;. These find wikitext without resorting to the [[regex]] searches this template does with &amp;#039;&amp;#039;insource:&amp;#039;&amp;#039;&amp;lt;kbd&amp;gt;/slash-delimited arguments/&amp;lt;/kbd&amp;gt;, (which is a common syntax for regex searches). See [[#About CirrusSearch|&amp;amp;sect; About CirrusSearch]] below for a better understanding of when this template is not needed.  See below for other search tools.&lt;br /&gt;
&lt;br /&gt;
[[Regular expressions]] are little computer programs, so it is characteristic of regex searches that they must always be tested to achieve their potential precision and thoroughness. But only a few of these intensive searches are technically able to run at a time against the database.  This template minimizes your footprint, and guarantees that you will never run an untested regexp on every namespace in the wiki, even if [[H:S#User preferences|your default search]] would let you do that.  Use of this template enables the smallest possible footprint by using filters to limit the search domain. The first domain it targets is its own page in an {{lang|la|ad hoc}} sandbox. Once your regexp pattern is honed, you add a search domain, by setting {{para|prefix}}.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
{{more|Help:Parameters}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|{{para|pattern}} or {{param|1}}|| a regexp search pattern. Pattern is also the first positional parameter.&lt;br /&gt;
|-&lt;br /&gt;
|{{para|prefix}} or {{param|2}}|| search domain. Prefix accepts a [[WP:namespace|namespace]] number, or &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; for the current namespace, or &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; for mainspace, plus it has [[H:S#Parameters|the usual &amp;#039;&amp;#039;prefix:&amp;#039;&amp;#039; meaning]]. Defaults to its current page ([[wp:fullpagename|fullpagename]]) if a pattern is given alone.&lt;br /&gt;
|-&lt;br /&gt;
|{{para|label}} or {{param|3}}|| search link label.  Label is also a positional parameter.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Procedure ==&lt;br /&gt;
&lt;br /&gt;
Decide whether you really need a thoroughly precise regexp search, or whether you can find the general wikitext of interest with a plain &amp;#039;&amp;#039;insource:&amp;#039;&amp;#039; filter. Examples of the plain &amp;#039;&amp;#039;insource:&amp;#039;&amp;#039; search are in [[#Parameters hastemplate and insource|&amp;amp;sect; Parameters hastemplate and insource]]. In those cases, {{tl|search link}} is sufficient, and sandboxing is not being suggested.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Namespace plus pagename equals fullpagename.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The procedure here is an iterative, read-evaluate-modify cycle.  &lt;br /&gt;
# Find an existing fullpagename with the wikitext instances you are interested in targeting. Or create one yourself, and save it to the database so the query will find it.  &lt;br /&gt;
# Open the wikitext, and enter a {{para|pattern}}. Prefix will be added later. &lt;br /&gt;
# Show Preview.  See the pattern in the newly created search link.&lt;br /&gt;
# Click on the search link. Note the bold text in each match, the centered, complete query, and note the count off to the right.&lt;br /&gt;
# Go back in your browser. Modify the regexp.  Cycle. Or don&amp;#039;t go back, you may need to majorly reset at the complete query.&lt;br /&gt;
# Enter a {{para|prefix}}. Start with a namespace.  At the complete query trim results via [[H:S#Parameters|the first letter(s) of]] pagenames tacked onto the namespace&amp;#039;s automatically-given colon.&lt;br /&gt;
&lt;br /&gt;
Step &amp;#039;&amp;#039;&amp;#039;6&amp;#039;&amp;#039;&amp;#039; is the core provision of this template.  &amp;#039;&amp;#039;Caveat emptor&amp;#039;&amp;#039;: if you change the &amp;#039;&amp;#039;target&amp;#039;&amp;#039;, you&amp;#039;ll have to re-save it to the database. If you target it again immediately, you&amp;#039;ll want to [[WP:Purge|purge]] that target.  You don&amp;#039;t have to ever purge &amp;#039;&amp;#039;if you just change {{para|pattern}}&amp;#039;&amp;#039;.  Note that you can target any single page using &amp;#039;&amp;#039;prefix:&amp;#039;&amp;#039;.&lt;br /&gt;
{{Help:Searching/Regex/Sandboxing}}&amp;lt;!--&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
{{Help:Searching/Features}}&amp;lt;!--&lt;br /&gt;
--&amp;gt;{{#section:Help:Searching/Regex|Regular expressions}}&amp;lt;!--&lt;br /&gt;
--&amp;gt;{{#section:Help:Searching/Regex|Metacharacters}}&lt;br /&gt;
For this template, it is necessary to enter the pipe character using &amp;lt;nowiki&amp;gt;\{{!}}&amp;lt;/nowiki&amp;gt; to find a literal pipe character in the wikitext.&lt;br /&gt;
{{#section:Help:Searching/Regex|Character classes}}&amp;lt;!--&lt;br /&gt;
--&amp;gt;{{#section:Help:Searching/Regex|Alternation}}&lt;br /&gt;
For this template, we need to replace the pipe character with {{tl|!}} so that the &amp;quot;pipe&amp;quot; for the regexp won&amp;#039;t confuse this template (or any other template).  We need the parentheses  at times because an alternation finds the &amp;#039;&amp;#039;longest&amp;#039;&amp;#039; pattern, and so the parentheses define that boundary, but it&amp;#039;s a boundary you don&amp;#039;t have to make if an alternation is the entire regexp patter.&lt;br /&gt;
&lt;br /&gt;
Regexp searches are restricted on the server, so this template reduces the&lt;br /&gt;
regex search footprint by using the &amp;#039;&amp;#039;prefix:&amp;#039;&amp;#039; filter every time,  restricting&lt;br /&gt;
the search domain to a namespace &amp;#039;&amp;#039;at most&amp;#039;&amp;#039;. The &amp;#039;&amp;#039;prefix:&amp;#039;&amp;#039; parameter can&lt;br /&gt;
further filter a namespace by specifying [[wp:pagename|pagename]]s that start&lt;br /&gt;
with a given letter(s).&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
== [[Template:Internal_search_templates_common_doc|Templates for searching Wikipedia ]] ==&lt;br /&gt;
{{Template:Internal_search_templates_common_doc|seealso=|level=2}}&lt;br /&gt;
* {{tl|template usage}}&lt;br /&gt;
* {{tl|search link}}&lt;br /&gt;
* {{tl|for loop}}&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata. --&amp;gt;&lt;br /&gt;
[[Category:Search templates]]&lt;br /&gt;
&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Frietjes</name></author>
	</entry>
</feed>