[pmwiki-users] Conditional extensions

Dominique Faure dominique.faure.1 at free.fr
Fri Apr 22 10:44:11 CDT 2005


At Thursday, April 21, 2005 8:07 PM [GMT+1=CET], Patrick R. Michaud wrote:

> OOPS!  Syntax errors in my message...
> 
> On Thu, Apr 21, 2005 at 01:01:12PM -0500, Patrick R. Michaud wrote:
> > The "?:" keeps the inner parens from being treated as a capture.
> > Alternately, if you don't care about the \s*, you could probably do
> > 
> >    $delims = '/\\s*(?:and|or|xor|&&|\\|\\||[!()])\\s*/i';
> 
> This should be
> 
>    $delims = '/\\s*(and|or|xor|&&|\\|\\||[!()])\\s*/i';
> 
> > [...]
> > so I think we have to actually delimit on required spaces and the
> > ends of the string:
> > 
> >    $delims = '/(?:^|\\s+)(?:and|or|xor|&&|\\|\\||[!()])(?:\\s+|$)/i';
> 
> And this should be
> 
>    $delims = '/(?:^|\\s+)(and|or|xor|&&|\\|\\||[!()])(?:\\s+|$)/i';
> 
> Pm


I'd like to keep the full php semantics with mandatory spaces required
only for non symbolic operators. Here's what I think as my final version:

$delims = '/(?:^|\\s*)(\\sand\\s|\\sx?or\\s|&&|\\|\\||[!()])(?:\\s*|$)/i';


Thanks again for the help,
Dom

PS:
> Wow, what a clever (and impressive) implementation!
I just tried to reach PmWiki's level!




More information about the pmwiki-users mailing list