[pmwiki-users] Wikipaths (was: PData support for pagelisting images)

Patrick R. Michaud pmichaud at pobox.com
Thu Sep 7 18:24:03 CDT 2006


On Fri, Sep 08, 2006 at 04:57:45AM +0530, V.Krishn wrote:
> On Friday 08 September 2006 03:57, Patrick R. Michaud wrote:
> > So, the regexp to find and replace this becomes something like:
> >
> >     preg_replace('/\\{(\\(\\w[^)]+\\)*)([^}]*)\\}/e',
> >                  "ApplyFunctions(PSS('$1'), PSS('$2'))", $x, $match)
> 
> not quite sure, should it be
>  preg_replace('/\\{(\\(\\w[^)]+\\))*([^}]*)\\}/e',
> //-----------------check n no of func------------
>                  "ApplyFunctions(PSS('$1'), PSS('$2'))", $x, $match)

Oh, we were both almost there.  It really needs to be:

    preg_replace('/\\{((?:\\(\\w[^)]+\\))*)([^}]*)\\}/e',

The point is to get all of the (...) functions into $1.

With all of those parentheses in there, perhaps it really is LISP!  :-)

Pm




More information about the pmwiki-users mailing list