--1926193751-911984625-12472397380641 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-911984625-1247239738=:30641" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-911984625-12472397380641 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT Hi -- On Sat, 11 Jul 2009, David Charles wrote: > #person / cogeco.ca is in the string test12 which is a string of email > addresses #separated by newline characters > #puts test12 prints out very nice listing of all email addresses on a > separate #line including the aforementioned person / cogeco.ca > #I tried it with a test13 object in which I "slice!"(ed) everything out > #according to /[A-Za-z0-9_.% / -]+ / but I got the same results and puts > test13 #basically shows the same as test12 with the newline characters > removed which #was what I expected. > > if(test12.include? "person@coge") then > puts "person@coge found" > else > puts "person@coge not found" > end > ------> Outputs -----> erson@coge found> > if(test12.include? "person@cogec") then > puts "person@cogec found" > else > puts "person@cogec not found" > end > ------->Outputs -------> ¡Æperson@cogec not found¡Ç > ----------------------------------------------------------------------- > > This is so bizarre I can¡Çt explain it.. I even tried splicing out all > newline characters etc and I still get the same results. As soon as I > get to the second ¡Æc¡Ç in cogec the string is not found in test12. Of > course my goal is to be able to find ¡Æperson / cogeco.ca¡Ç in the string > test12 since it is in the string test12. > > (please note that I¡Çve changed the original email address to person in > order to protect privacy) > > Please let me know if there is a solution to this problem or if you have > any ideas. There has to be something going on beyond what you're describing. String#include? does work: >> str person / cogeco.ca" "person / cogeco.ca" >> str.include?("person@coge") true >> str.include?("person@cogec") true Can you post an entire irb session, or equivalent, where you're getting this problem, including showing the value of the whole string (edited for privacy, of course :-) David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) Training! Intro to Ruby, with Black & Kastner, September 14-17 (More info: http://rubyurl.com/vmzN) --1926193751-911984625-12472397380641-- --1926193751-911984625-12472397380641--