[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] cut



The way I prefer:

    @items = m/(<.*?>)/g;

In an array context with the /g modifier, m// will return a list of all
matching call backs (patterns in parens). I believe this is faster and more
reliable than split, especially if there is the possibility that random data
will exist between angle-bracketed strings, such as with an email.

-K

"Do not meddle in the affairs of wizards, for they are subtle and quick to
anger."


> From: Matthias Dorn <dorn@sigmatics.co.jp>
> Reply-To: mdorn@gol.com
> Date: Wed, 13 Dec 2000 19:53:59 +0900
> To: MacPerl <macperl@macperl.org>
> Subject: [MacPerl] cut
> 
> Hello
> 
> I am looking for a way to extract multiple occurances of a substring (in my
> case something in rectangular brackets /^<.+$>/ in such a way that the
> resultant list includes the brackets and its content.
> 
> for example if i do a split at ">" somehow it gets cut of ?
> 
> but I seem not able to do this and yes, I am a newbie and sorry to bug you
> (well not really)
> 
> Yours
> Matthias
> 
> # ===== Want to unsubscribe from this list?
> # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org
> 
> 


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org