[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Odd behavior of String#scan

Daniel Sheppard

12/22/2005 12:44:00 AM

> From: Dan Diebolt [mailto:dandiebolt@yahoo.com]
>
> Will this do?
>
> s="abcSTARTdef,ghi,jkl,ENDmno"
> s.scan(/START(.*)END/).to_s.split(",")
>
> => ["def", "ghi", "jkl"]


s="abcSTARTdef,ghi,jkl,ENDmno"
/START(.*)END/.match(s)[1].split(",")

Better conveys the intention to me, but YMMV.

#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by NetIQ MailMarshal
#####################################################################################


1 Answer

Florian Groß

12/22/2005 1:24:00 AM

0