Jump to content

Template talk:Regex

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Template talk:Regex/doc)

Literal search option

[edit]

This template should feature an option for making the search literal. It would automatically quote all punctuation for the user. It might take an argument that is thousands of words long that was cut and paste from elsewhere, and quote the periods, and plus signs and all.

Couldn't hurt. Doesn't hurt to quote. CirrusSearch just ignores unnecessary quoting, and goes ahead and finds the character literally, no matter what else. — CpiralCpiral 18:52, 12 August 2015 (UTC)[reply]

Just use double quotes to escape all metacharacters: insource/"everything in here is literal because escaped, quoted even by virtue of the double quotes. Even every space, etc."/ Don't forget to use a filter beside it. — CpiralCpiral 07:48, 14 August 2015 (UTC)[reply]

I must be really stupid

[edit]

But I want to perform a regex search on Wikipedia articles, and I keep finding policies and stuff. How do I actually just do a search to find all page titles matching, say, ^l.*s$? Why is this not obvious? Equinox 22:38, 12 March 2017 (UTC)[reply]

Greediness

[edit]

No mention of * and + (non-)greediness. —Mykhal (talk) 12:25, 21 December 2017 (UTC)[reply]

Running bare insource:/regexp/ searches is not cool

[edit]

See mw:Help:CirrusSearch#Boost-templates. Also, such requests are just many times slower and often time out.

Ideally, this template should add a insource:"..." part (without regexp) before the actual insource:/.../, as per the aforementioned link. But some character transformations would be needed to be done (remove \ that are used for character escaping etc.). JWBTH (talk) 14:55, 11 July 2023 (UTC)[reply]