[email protected] skrev:
> 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
I take it you mean s/\{\|.+?\|\}?//gs . That would not work
because it would make the match stop at the first "|" inside
the table, which would probably be part of a caption marker
"|+" or a row marker "|-", or a cell marker "|".
The substitution s/\{\|.+?\|\}//gs (and no other AFAICT) will
delete all tables. To be fool-proof against parser function
and template syntax like "{{{1|}}}" it should probably be amended
to
s/(?<!\{)\{\|.+?\|\}(?!\})//gs
which makes sure that the opening/closing brace isn't
preceded/followed by another brace. Incidentally and
correctly any /\{\{+\|/ or /\|\}\}+/ *inside* a table
will be included in the match and deleted.
/BP
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] 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
> [email protected]
> 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.
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l