Wikipedia:Reference desk/Archives/Computing/2023 May 14

= May 14 =

Regex help requested
Wasn't sure whether to take this to Request a query, Help desk, or here. Landed here.I'm tryna search wikipedia for articles containing Template:Infobox royalty where the clan_name parameter is non-empty. I used to speak regex twenty years ago, to the point where I once wrote my own parser, but my memory is failing me here. I know my search is supposed to start with hastemplate:"Infobox royalty" insource=/clan_name..., but my efforts to complete the regex in such a way that returns how I'm wanting have led only to results where clan_name is defined but null, and empty sets. Assistance would be appreciated. Shamefully, Folly Mox (talk) 16:38, 14 May 2023 (UTC)
 * I haven't use regex in a Wikipedia search. In basic regex, you want something like "clan_name\s*=\s*\w", which demands "clan_name" followed by zero or more spaces followed by "=" followed by zero or more spaces followed by a word character. But, without a reference to the interpreter, it is difficult to know if it uses \s for space and \w for word character. 97.82.165.112 (talk) 12:25, 15 May 2023 (UTC)
 * I don't know if \s and \w work in Wikipedia regexes either, but if they don't, you should be able to use something like clan_name *= *[^ ] . CodeTalker (talk) 03:59, 17 May 2023 (UTC)
 * Have to consider | as well clan_name *= *[^| ] Graeme Bartlett (talk) 02:15, 18 May 2023 (UTC)