Wikipedia talk:AutoWikiBrowser/Regular expression

Latest comment: 11 days ago by 8rz in topic Regex help

Regex help

edit

I am trying to remove wikilinks from (#/#) in List of Grand Slam women's singles champions#Champions by year

from

{{small|([[1886 Wimbledon Championships – Women's singles|1/6]])}}

to

{{small|(1/6)}}

by using (\{\{small\|\()\[\[Women's singles\|(\d+\/\d+)\]\]\)\}\} -> $1$2), which works on individual cases but not on a big table. It instead removes multiple cells. Any help would be appreciated. 8rz (talk) 12:03, 24 September 2025 (UTC)Reply

I've replaced your {!} with | in your text above since it's already nowiki'd. It looks like you're missing some qualifiers; your example is 1886 Wimbledon Championships – Women's singles but your regex only looks for Women's singles. I'm going to play around with the regex a bit and see if I can get something that's a bit more robust. Primefac (talk) 22:17, 24 September 2025 (UTC)Reply
Try \{\{small\s*\|\s*\(\[\[[^\|]*\|(\d*\/\d*)\]\]\)}} replacing with {{small|$1}} since I'm lazy and can't be bothered sorting out the extra grouping. Primefac (talk) 22:26, 24 September 2025 (UTC)Reply
There are over 400 instances that need to be unlinked in the chart provided in the above link. 8rz (talk) 22:29, 24 September 2025 (UTC)Reply
Gets the job done. Thanks. 8rz (talk) 22:31, 24 September 2025 (UTC)Reply