On 9/22/06, Nick Jenkins <nickpj(a)gmail.com> wrote:
Don't use
pipe links for [[plural word]]s.
Sounds good, that's been added now, and it should transform any proposed link variant
of the form [[X|Y]], where X is a substring of
Y, and where X and Y contain an equal number of spaces, into [[X]]rest-of-Y.
Better solution:
preg_replace("/\\[\\[([$linkprefixchars]*)([^]|]+)([$linktrailchars]*)\|$1\]\]/",
"$1[[$2]]$3", $text), where $linkprefixchars and $linktrailchars are
grabbed from the appropriate language file. (Regex is untested and
might contain typos and/or other errors, but you probably get the
point: try to use the exact matching technique that MediaWiki itself
uses.)