Q:

Ruby on a Mac -- Regular Expression Spanning Two Lines of Text

On the PC, the following Ruby regular expression matches data. However, when run on the Mac against the same input text file, no matches occur. Am I matching line returns in a way that should work cross-platform?
data = nil
File.open(ARGV[0], "r") do |file|
    data = file.readlines.join("").scan(/^Name: (.*?)[\r\n]+Email: (.*?)$/)
end

Versions
PC: ruby 1.9.2p135
Mac: ruby 1.8.6
Thank you,
Ben

A:

The problem was the ^ and $ pattern characters! Ruby doesn't consider \r (a.k.a. ^M) a line boundary.  If I modified my pattern, replacing both ^ and $ with "\r", the pattern matched as desired. 
data = file.readlines.join.scan(/\rName: (.*?)\rEmail: (.*?)\r/)

Instead of modifying the pattern, I opted to do a gsub on the text, replacing \r with \n before calling scan.
data = file.readlines.join.gsub(/\r/, "\n").scan(/^Name: (.*?)\nEmail: (.*?)$/)

Thank you each for your responses to my question.

