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

Enkidu enkidu at cliffp.com
Wed Nov 6 03:05:03 CST 2002


OK, thanks. What does the "[]" constract do? 

Cheers,

Cliff


On Wed, 6 Nov 2002 17:53:17 +1300, you wrote:

>Your regex as written is going to snag the leading space after the comma.
>
>What I think you want is:
>
>m{.*/(.*)\.jpg,\s(.*)$/}
>
>(I like using m{} to avoid leaning toothpick syndrome).
>
>Also, greedy matching could lead to undesitable things in $1. Possibly something like:
>
>m{.*/([^/]*)\.jpg,\s([^/]*)$/}
>
>would be better?
>
>Stephen
>
>> -----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.
>> 

--  

The Nats held a Party and no one came.



More information about the Wellington-pm mailing list