Difference between revisions of "Template:Search"

(Corrected descriptive text)
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
   |namespace =  
 
   |namespace =  
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
   |titlematch = A%{{!}}B%{{!}}C%{{!}}D%{{!}}E%{{!}}F%{{!}}G%{{!}}H%{{!}}I%{{!}}J%
+
   |titleregexp = ^[A-J]
 
   |include = *
 
   |include = *
 
   |includematch = @{{{1}}}@
 
   |includematch = @{{{1}}}@
 
   |includemaxlength = 0
 
   |includemaxlength = 0
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 +
| resultsheader = There are %TOTALPAGES% pages beginning with A-J\n
 
}}
 
}}
 
{{#dpl:
 
{{#dpl:
 
   |namespace =  
 
   |namespace =  
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
   |titlematch = K%
+
   |titleregexp = ^K[A-Z]
 
   |include = *
 
   |include = *
 
   |includematch = @{{{1}}}@
 
   |includematch = @{{{1}}}@
 
   |includemaxlength = 0
 
   |includemaxlength = 0
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 +
| resultsheader = There are %TOTALPAGES% pages beginning with KA-KZ\n
 
}}
 
}}
 
{{#dpl:
 
{{#dpl:
 
   |namespace =  
 
   |namespace =  
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
   |titlematch = L%{{!}}M%{{!}}N%{{!}}O%{{!}}P%{{!}}Q%{{!}}R%{{!}}S%{{!}}T%{{!}}U%{{!}}V%{{!}}W%{{!}}X%{{!}}Y%{{!}}Z%
+
   |titleregexp = ^K[a-ce-z]
  |include = *
 
  |includematch = @{{{1}}}@
 
  |includemaxlength = 0
 
  |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 
}}</includeonly><noinclude>
 
<!--{{#dpl:
 
  |namespace =
 
  |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
 
  |titlematch = A%{{!}}B%{{!}}C%{{!}}D%{{!}}E%{{!}}F%{{!}}G%{{!}}H%{{!}}I%{{!}}J%
 
 
   |include = *
 
   |include = *
 
   |includematch = @{{{1}}}@
 
   |includematch = @{{{1}}}@
 
   |includemaxlength = 0
 
   |includemaxlength = 0
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 +
| resultsheader = There are %TOTALPAGES% pages beginning with Ka-Kz but not Kd\n
 
}}
 
}}
 
{{#dpl:
 
{{#dpl:
 
   |namespace =  
 
   |namespace =  
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
   |titlematch = K%
+
   |titleregexp = ^Kd
 
   |include = *
 
   |include = *
 
   |includematch = @{{{1}}}@
 
   |includematch = @{{{1}}}@
 
   |includemaxlength = 0
 
   |includemaxlength = 0
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 +
| resultsheader = There are %TOTALPAGES% pages beginning with Kd\n
 
}}
 
}}
 
{{#dpl:
 
{{#dpl:
 
   |namespace =  
 
   |namespace =  
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
 
   |nottitleregexp = .*((/[a-z][a-z](.{{!}}-..)?){{!}}([ _][(][a-z][a-z][)]))$
   |titlematch = L%{{!}}M%{{!}}N%{{!}}O%{{!}}P%{{!}}Q%{{!}}R%{{!}}S%{{!}}T%{{!}}U%{{!}}V%{{!}}W%{{!}}X%{{!}}Y%{{!}}Z%
+
   |titleregexp = ^[L-Z]
 
   |include = *
 
   |include = *
 
   |includematch = @{{{1}}}@
 
   |includematch = @{{{1}}}@
 
   |includemaxlength = 0
 
   |includemaxlength = 0
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
 
   |format = ,\n* [[%PAGE%{{!}}%TITLE%]],,
}}-->
+
| resultsheader = There are %TOTALPAGES% pages beginning with L-Z\n
 +
}}</includeonly><noinclude>
 
Find pages containing a string: <code><nowiki>{{Search|</nowiki>'''''string'''''<nowiki>}}</nowiki></code> finds all pages containing the '''''string'''''. Searches are case sensitive. In order to find both ''xyz'' and ''Xyz'' use a regular expression: <code><nowiki>{{Search|[Xx]yz}}</nowiki></code>.
 
Find pages containing a string: <code><nowiki>{{Search|</nowiki>'''''string'''''<nowiki>}}</nowiki></code> finds all pages containing the '''''string'''''. Searches are case sensitive. In order to find both ''xyz'' and ''Xyz'' use a regular expression: <code><nowiki>{{Search|[Xx]yz}}</nowiki></code>.
  
Line 59: Line 55:
  
 
No wiki expansion takes place before passing arguments to the template.
 
No wiki expansion takes place before passing arguments to the template.
 +
 +
{{Warning|1=Due to the limitations of the underlying database queries, the search is split in five parts, each searching less that 500 pages. To check that this limit is not exceeded, the number of pages in each search is also printed. Should one of the page counts exceed 500, some pages will have been ignored. The template then needs to be modified!}}
  
 
Example: <code><nowiki>{{Search|1=Learn more}}</nowiki></code> gives
 
Example: <code><nowiki>{{Search|1=Learn more}}</nowiki></code> gives
 
{{Search|1=Learn more}}
 
{{Search|1=Learn more}}
{{Search|1=description}}
+
 
 
[[Category:Template]]
 
[[Category:Template]]
 
</noinclude>
 
</noinclude>

Latest revision as of 14:50, 19 January 2014

Find pages containing a string: {{Search|string}} finds all pages containing the string. Searches are case sensitive. In order to find both xyz and Xyz use a regular expression: {{Search|[Xx]yz}}.

Regular expressions use a perl like syntax. Special characters like '[', '[','(' and ')' need to be escaped.

No wiki expansion takes place before passing arguments to the template.

Warning.png
Warning
Due to the limitations of the underlying database queries, the search is split in five parts, each searching less that 500 pages. To check that this limit is not exceeded, the number of pages in each search is also printed. Should one of the page counts exceed 500, some pages will have been ignored. The template then needs to be modified!


Example: {{Search|1=Learn more}} gives

{{#dpl:

 |namespace = 
 |nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z][)]))$
 |titleregexp = ^[A-J]
 |include = *
 |includematch = @Learn [email protected]
 |includemaxlength = 0
 |format = ,\n* %TITLE%,,

| resultsheader = There are %TOTALPAGES% pages beginning with A-J\n }} {{#dpl:

 |namespace = 
 |nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z][)]))$
 |titleregexp = ^K[A-Z]
 |include = *
 |includematch = @Learn [email protected]
 |includemaxlength = 0
 |format = ,\n* %TITLE%,,

| resultsheader = There are %TOTALPAGES% pages beginning with KA-KZ\n }} {{#dpl:

 |namespace = 
 |nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z][)]))$
 |titleregexp = ^K[a-ce-z]
 |include = *
 |includematch = @Learn [email protected]
 |includemaxlength = 0
 |format = ,\n* %TITLE%,,

| resultsheader = There are %TOTALPAGES% pages beginning with Ka-Kz but not Kd\n }} {{#dpl:

 |namespace = 
 |nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z][)]))$
 |titleregexp = ^Kd
 |include = *
 |includematch = @Learn [email protected]
 |includemaxlength = 0
 |format = ,\n* %TITLE%,,

| resultsheader = There are %TOTALPAGES% pages beginning with Kd\n }} {{#dpl:

 |namespace = 
 |nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z][)]))$
 |titleregexp = ^[L-Z]
 |include = *
 |includematch = @Learn [email protected]
 |includemaxlength = 0
 |format = ,\n* %TITLE%,,

| resultsheader = There are %TOTALPAGES% pages beginning with L-Z\n }}


This page was last edited on 19 January 2014, at 14:50. Content is available under Creative Commons License SA 4.0 unless otherwise noted.
-->