new warning in 1.8 from String#split

P

Phil Tomson

I've got a little email filtering program that I've been using for a while
that has the line:

msg.header.split("\r\n").grep(/^From: /)

When I tried to run this script on Ruby 1.8 I got:

"warning: string pattern instead of regexp; metacharacters no longer
effective"

A bit of irb'ing and I determined that the problem is the split("\r\n")
and it'll apparently work fine if I change the string to a regex.

So does this basically mean that if we're using escaped characters in the
split that we can no longer use strings and we must use regexen?

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top