[Wellington-pm] Today's tricky perl teaser

Grant McLean grant at mclean.net.nz
Tue Nov 28 11:50:46 PST 2006


On Tue, 2006-11-28 at 23:01 +1300, Cliff Pratt wrote:
> Grant McLean wrote:
> > Also, when capturing the date/time, you probably want to move the
> > square brackets so they're not part of what you capture:
> > 
> > 
> > \s+\[(.*?)\]            # Date / time
> > 
> Yes, I'd noticed that already, though it wasn't in the pasted snippet. I 
> also included the ^ in the first (). Someone pointed that out to me. 
> Would that have any unintended effect?

No, ^ is a 'zero width assertion' so when it matches, no characters are
contributed to any surrounding captures.

Cheers
Grant



More information about the Wellington-pm mailing list