Donald J Organ IV wrote:
I was wondering if anyone else has done this and if they have the code readily available.
I want to be able to parse wiki style links such as

[[page|title]]
[[page]]

Any suggestions ??

Something like this might be a start:

$str = preg_replace(
  array(
    '/\[\[([^|\]]+)\]\]/U',
    '/\[\[([^|\]]+)|([^\]]+)\]\]/U',
  ),
  array(
    '<a href="$1">$1</a>',
    '<a href="$1">$2</a>',
  ),
  $str
);

Disclaimer: I haven't tried running this code.

Dan
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to