[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Memo to self.

John Carter

2/20/2006 2:18:00 AM

2 Answers

Hal E. Fulton

2/20/2006 2:21:00 AM

0

John Carter wrote:
> Never under estimate what you can achieve with
> IO.read( "filename").scan(%r{}mx) do |match|
> end
>
> Especial as you can control how greedy the regex is with .*?
>
> I just deleted a lot of code and replaced it with one line.

Well, as your self.memo included the rest of us, how about
sharing the example?


Hal



William James

2/20/2006 11:37:00 AM

0

John Carter wrote:
> Never under estimate what you can achieve with
> IO.read( "filename").scan(%r{}mx) do |match|
> end
>
> Especial as you can control how greedy the regex is with .*?
>
> I just deleted a lot of code and replaced it with one line.
>
> John Carter Phone : (64)(3) 358 6639
> Tait Electronics Fax : (64)(3) 359 4632
> PO Box 1645 Christchurch Email : john.carter@tait.co.nz
> New Zealand
>
> Carter's Clarification of Murphy's Law.
>
> "Things only ever go right so that they may go more spectacularly wrong later."
>
> From this principle, all of life and physics may be deduced.

# Read and parse the first file on the command line.
gets(nil).scan( //mx ) { |s|
}
# Read and parse the rest of the files.
ARGF.read.scan( //mx ) { |s|
}