What's a quick and real neat way of....

Stephen Judd StephenJ at web.co.nz
Tue Nov 5 22:53:17 CST 2002

Your regex as written is going to snag the leading space after the comma.

What I think you want is:


(I like using m{} to avoid leaning toothpick syndrome).

Also, greedy matching could lead to undesitable things in $1. Possibly something like:


would be better?


> -----Original Message-----
> From: Enkidu [mailto:enkidu at cliffp.com]
> Sent: Wednesday, 6 November 2002 4:59 p.m.
> To: wellington-pm-list at pm.org
> Subject: What's a quick and real neat way of....
> .....extracting the abcd and the string "This is abcd" from the
> following:
> $var = "blah/blah/blah/abcd.jpg, This is abcd" ;
> What I've come up with so far is:
> $var = /.*\/(.*).jpg,(.*)$/ ;
> Of course, I'm going to try it out when I get a chance, but what are
> my chances of success? abcd varies as does the string.
> Cheers,
> Clif
> --  
> The Nats held a Party and no one came.

More information about the Wellington-pm mailing list