Jump to content

Help talk:Searching/Regex

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Backreference

Is there a way to use Backreference (e.g. (.)\1 )? Uziel302 (talk) 20:21, 27 July 2020 (UTC)[reply]

@Uziel302: No, that's not supported; \1 just matches a literal "1". For example, try this search. -- John of Reading (talk) 21:09, 27 July 2020 (UTC)[reply]
John of Reading, that's why I asked, and couldn't find on which level it is, mediawiki/elastic/lucene. Uziel302 (talk) 12:35, 28 July 2020 (UTC)[reply]
โ€‹โ€‹ Me would like to see reference for the no-support status (it may be supported with a different syntax), rather than another non-working example, too. โ€”Mykhal (talk) 10:03, 5 October 2020 (UTC)[reply]
@Mykhal: I'm not clear on the difference between mediawiki/elastic/lucene. Perhaps ask at WP:VPT to find someone who knows their way around the source code. I think that's the only possible reference for something not being supported. -- John of Reading (talk) 15:18, 5 October 2020 (UTC)[reply]

Dot . not matching newline

Dot . will match a newline, or any character in the targeted position[1] Does it really? It doesn't seem to be doing it here. For instance, \|-.*\| doesn't match the beginning of table of rows. Am I doing it wrong? โ€” ๐†๐ฎ๐š๐ซ๐š๐ฉ๐ข๐ซ๐š๐ง๐ ๐š (talk) 03:58, 19 May 2021 (UTC)[reply]

Start and end of regexp for title

There is a text on the page: Regex experts should note that ^ does not mean "beginning of text" and $ does not mean "end of text." Searching from the beginning or end of a Wikipedia page is not generally useful.

However, searching from the beginning or end of a title is useful. Can you please implement these characters for the title? Maxim Masiutin (talk) 17:41, 14 December 2023 (UTC)[reply]

I agree, they are indeed useful. By the way, in case you aren't aware, WP:PetScan supports the regex metacharacters ^ and $; see this discussion for examples. --JAAqqO (talk) 19:28, 14 December 2023 (UTC)[reply]