[pmwiki-users] brackets without space

Patrick R. Michaud pmichaud at pobox.com
Fri Jan 27 15:16:36 CST 2006


On Fri, Jan 27, 2006 at 09:33:27PM +0100, Jens Schiffler wrote:
> ** Reply to message from JB <jbit at ev1.net> on Fri, 27 Jan 2006 14:09:21 -0600
> 
> 
> > I need regular expression help.
> > 
> > Here is my current regular expression:
> > 
> >   /^\\[([^[].*?)\\]/
> 
> I assume the double backslash was inserted by your mailer.

In PHP I'm in the habit of always doubling my backslashes in
regular expressions, because PHP has some odd rules with
backslash escapes.  (By doubling them I don't have to worry
about it.)

>  /^\[([^[]?.*?)\]/
> meaning: At line begin match a single "[" followed by zero or one "non ]",
> followed by anything, followed by "]"

This would match doubled-brackets -- i.e., it would match [[something]] 
(the last ] wouldn't be part of the match).

Pm




More information about the pmwiki-users mailing list