V
Vell
Hello all,
I am trying to get a file into an array using .scan and I can't seem
to get anything to work properly.
I am reading in a file of email addresses (1 per line) and it all
seems to come in as 1 long string some how. I am trying to use scan
to break it up into an array of emails so that I can do some uniq
checks and validation with other arrays. But I just don't seem to get
it right.
My code right now is as follows:
emails = File.open("/users/lem/desktop/test/
POCs_DNB.txt","r").readlines.map! {|x| x.chomp} # Read in the list
of emails
email.scan(/\S+/) # To mach on spaces (I assume). I thought I would
be matching on new lines
puts email # To verify
When I did an inspect on the email variable The address appeared as
such
"(e-mail address removed)\[email protected]\[email protected]......"
This is my absolute first time working with .scan and regular
expressions so I have a little bit of a learning curve with this one.
Any help is greatly appreciated.
I am trying to get a file into an array using .scan and I can't seem
to get anything to work properly.
I am reading in a file of email addresses (1 per line) and it all
seems to come in as 1 long string some how. I am trying to use scan
to break it up into an array of emails so that I can do some uniq
checks and validation with other arrays. But I just don't seem to get
it right.
My code right now is as follows:
emails = File.open("/users/lem/desktop/test/
POCs_DNB.txt","r").readlines.map! {|x| x.chomp} # Read in the list
of emails
email.scan(/\S+/) # To mach on spaces (I assume). I thought I would
be matching on new lines
puts email # To verify
When I did an inspect on the email variable The address appeared as
such
"(e-mail address removed)\[email protected]\[email protected]......"
This is my absolute first time working with .scan and regular
expressions so I have a little bit of a learning curve with this one.
Any help is greatly appreciated.