[Mediawiki-l] REGEXP for wiki tables

Sam.Sexton at thomsonreuters.com Sam.Sexton at thomsonreuters.com
Fri Aug 7 07:21:35 UTC 2009


I believe that making the match for } non-greedy as below would match
just the one table, but I've not tried it.

s/\{\|.+?\|\?}//gs 

/Sam


-----Original Message-----
From: mediawiki-l-bounces at lists.wikimedia.org
[mailto:mediawiki-l-bounces at lists.wikimedia.org] On Behalf Of
Christensen, Courtney
Sent: 06 August 2009 21:05
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] REGEXP for wiki tables


Benct Philip Jonsson wrote:
>On 2009-08-05 Matthias Korn wrote:
>> I have now settled with "\{[^\}]+\}" which is far from perfect, 
>> because it also matches (partially) on templates. But that's ok.
>> 
>s/\{\|.+?\|\}//gs would do a lot better, since wikitables start in "{|"

>and end in "|}" and would not touch templates.
>
>/BP

But that would sometimes grab more than just one table.
-Courtney

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l at lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


This email was sent to you by Thomson Reuters, the global news and information company.
Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.





More information about the MediaWiki-l mailing list