From: Peter Bailey Date: 2007-09-20T01:20:38+09:00 Subject: Re: finding string matches, in order, in a file William James wrote: > On Sep 19, 7:03 am, Peter Bailey wrote: > >> .. > Very odd. "scan" will return the strings in the order that > they are found. > > How did your program read the file? Could its contents have > been disordered somehow? After your program reads the file > into a string, have it write the string to a temp file and > then use fc or diff to compare the 2 files. > > "Health Issues" appears twice; I presume the file contains > two entries. > > You've probably had your editor do a string search to verify > that "Immigration" isn't the first entry in the file. Yes, as I said yesterday, the word "Immigration" is on line 300+, and, the first entry that should be seen is the "Trade" one. Before I do this scan, I do a sweep where I delete all the extra white space at the beginning of each line. There's a lot of it there. I've tried this without that sweep, but, I get the same results, especially after, with your help, I was more generic in my definition of the white space around these entries. I did a write of this array as a string to a file. When I pulled up the file, it looks exactly like the output of my script. -- Posted via http://www.ruby-forum.com/.