[Pmwiki-users] Dev Tip: Function Pointers

Patrick R. Michaud pmichaud
Mon Mar 22 22:36:28 CST 2004


On Tue, Mar 23, 2004 at 06:18:11AM -0800, Steven Leite wrote:
> 
>    Q:  Is it possible to do something similar when the [[hook:]] contains
>    a back-reference from a regexp?
> 
>    $SquareBrackets["[[regexp]]"] = MyFunction($1);

Sure, just use the /e modifier in the regexp:

     $DoubleBrackets['/\\[\\[regexp\\]\\]/e'] = "MyFunction('$1')";

See http://www.php.net/manual/en/pcre.pattern.modifiers.php and the
preg_replace function.

Pm



More information about the pmwiki-users mailing list