P
Phil Tomson
I thought .. meant inclusive and ... meant 'not including matching lines'.
Why do these snippets both do exactly the same thing:
irb(main):032:0> File.open('filename') {|f|
irb(main):033:1* f.each_line{|l|
irb(main):034:2* puts l if l=~/BEGIN/ .. l=~/END/
irb(main):035:2> }
irb(main):036:1> }
Output:
10 BEGIN PATTERN
eleven
12
thirteen
14 END PATTERN
irb(main):026:0> File.open('filename') {|f|
irb(main):027:1* f.each_line{|l|
irb(main):028:2* puts l if l=~/BEGIN/ ... l=~/END/
irb(main):029:2> }
irb(main):030:1> }
Output:
10 BEGIN PATTERN
eleven
12
thirteen
14 END PATTERN
Both .. and ... produced the same output. I would have expected the
output of the second snippet to be:
eleven
12
thirteen
???
Phil
Why do these snippets both do exactly the same thing:
irb(main):032:0> File.open('filename') {|f|
irb(main):033:1* f.each_line{|l|
irb(main):034:2* puts l if l=~/BEGIN/ .. l=~/END/
irb(main):035:2> }
irb(main):036:1> }
Output:
10 BEGIN PATTERN
eleven
12
thirteen
14 END PATTERN
irb(main):026:0> File.open('filename') {|f|
irb(main):027:1* f.each_line{|l|
irb(main):028:2* puts l if l=~/BEGIN/ ... l=~/END/
irb(main):029:2> }
irb(main):030:1> }
Output:
10 BEGIN PATTERN
eleven
12
thirteen
14 END PATTERN
Both .. and ... produced the same output. I would have expected the
output of the second snippet to be:
eleven
12
thirteen
???
Phil