Lompat ke isi

Cèṭa'an:Regex/doc

Ḍâri Wikipèḍia bhâsa Madhurâ, lombhung pangataowan mardhika

TemplateStyles' src attribute must not be empty.

TemplateStyles' src attribute must not be empty.

Galat: tidak ada pintasan yang ditentukan |msg= parameter tidak ditentukan.

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.

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 search link that can also be used to share such discoveries. This template can also be used to learn the regular expression syntax of this version of Cirrus Search. You could use a bare {{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.

An important alternative to using this template is performing a search directly with insource:"quotes-delimited arguments". These find wikitext without resorting to the regex searches this template does with insource:/slash-delimited arguments/, (which is a common syntax for regex searches). See § About CirrusSearch below for a better understanding of when this template is not needed. See below for other search tools.

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 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 ad hoc sandbox. Once your regexp pattern is honed, you add a search domain, by setting |prefix=.

Parameters

[beccè' sombher]
|pattern= or {{{1}}} a regexp search pattern. Pattern is also the first positional parameter.
|prefix= or {{{2}}} search domain. Prefix accepts a namespace number, or n for the current namespace, or : for mainspace, plus it has the usual prefix: meaning. Defaults to its current page (fullpagename) if a pattern is given alone.
|label= or {{{3}}} search link label. Label is also a positional parameter.

Procedure

[beccè' sombher]

Decide whether you really need a thoroughly precise regexp search, or whether you can find the general wikitext of interest with a plain insource: filter. Examples of the plain insource: search are in § Parameters hastemplate and insource. In those cases, {{search link}} is sufficient, and sandboxing is not being suggested.

Namespace plus pagename equals fullpagename.

The procedure here is an iterative, read-evaluate-modify cycle.

  1. 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.
  2. Open the wikitext, and enter a |pattern=. Prefix will be added later.
  3. Show Preview. See the pattern in the newly created search link.
  4. Click on the search link. Note the bold text in each match, the centered, complete query, and note the count off to the right.
  5. Go back in your browser. Modify the regexp. Cycle. Or don't go back, you may need to majorly reset at the complete query.
  6. Enter a |prefix=. Start with a namespace. At the complete query trim results via the first letter(s) of pagenames tacked onto the namespace's automatically-given colon.

Step 6 is the core provision of this template. Caveat emptor: if you change the target, you'll have to re-save it to the database. If you target it again immediately, you'll want to purge that target. You don't have to ever purge if you just change |pattern=. Note that you can target any single page using prefix:. Bhântowan:Searching/Regex/Sandboxing Bhântowan:Searching/FeaturesBhântowan:Searching/RegexBhântowan:Searching/Regex For this template, it is necessary to enter the pipe character using \{{!}} to find a literal pipe character in the wikitext. Bhântowan:Searching/RegexBhântowan:Searching/Regex For this template, we need to replace the pipe character with {{!}} so that the "pipe" for the regexp won't confuse this template (or any other template). We need the parentheses at times because an alternation finds the longest pattern, and so the parentheses define that boundary, but it's a boundary you don't have to make if an alternation is the entire regexp patter.

Regexp searches are restricted on the server, so this template reduces the regex search footprint by using the prefix: filter every time, restricting the search domain to a namespace at most. The prefix: parameter can further filter a namespace by specifying pagenames that start with a given letter(s).

Templates for searching Wikipedia

[beccè' sombher]
[beccè' sombher]

A search link stores a query in a link that takes you to live search results for that stored search. They're found on user pages and talk pages. Use one to bring the full feature set of MediaWiki Search, or features of external search engines, to bear on users unfamiliar with their search parameters.

One type of search link is a wikilink with all the capabilities of Search (search box), and with standard wikilink syntax: [[Special:Search/query| label]]. So this search link will (1) navigate: [[Special:search/Wales]] → Special:search/Wales or (2) search: [[Special:search/~Wales | search/~Wales]]search/~Wales if you prefix a ~ tilde character.

All other search links are made from a template that will build a URL instead of wikilink. A URL can for example can call off-site search engines to search Wikipedia.

Search boxes

[beccè' sombher]

Search boxes are made by <inputbox> tags. See mw:Extension:InputBox.

Page title searches

[beccè' sombher]
  • {{Canned search}} – Link to automated search results for a given term
  • {{In title}} – Search for pages whose name contains given words
  • {{Look from}} – Search for pages whose name begins with a given word

For searches with exact matches, exact in upper and lower cases, or in punctuation marks, see Help:Searching § grep.

Other Wikipedia editor help

[beccè' sombher]

See also

Cèṭa'an:Search templates