[pmwiki-users] Markup: Extract the group name from argument $1

Patrick R. Michaud pmichaud at pobox.com
Sun Jan 30 20:44:37 CST 2005


On Sun, Jan 30, 2005 at 09:30:19PM -0500, Claude Montpetit wrote:
> I want to create a custom markup that looks like this:
>     Markup("x'", "inline", "/x'(.*?)'x/", "<div>[[$1 | y]]</div>");
> where "y" is the group extracted from $1. I want to use this like that:
>     x'Fr.PageEnFrancais'x
> which should return:
>     <div>[[Fr.PageEnFrancais | Fr]]</div>
> I am not sure if this can be done. Can the $1 argument be parsed in this 
> markup definition ?

Markup("x'", "inline",
  "/x'(([^\\/.]+).*?)'x/",
  "<div>[[$1 | $2]]</div>");

The outer parens capture everything between x' and 'x into $1.
The inner parens capture the group part (everything before a dot
or slash) into $2.

Pm



More information about the pmwiki-users mailing list