Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3351

Parsing text

From Cyril Jose <cyril_jose@ymail.com>
Newsgroups comp.lang.ruby
Subject Parsing text
Date 2011-04-21 20:43 -0500
Organization Service de news de lacave.net
Message-ID <75e6c383a0a6a5d072fdbe3ba9a7ceb5@ruby-forum.com> (permalink)

Show all headers | View raw


Hey all,

I have a file where I need to parse information from. The format of the
first line is something like this:

">ruby ruby |ruby|ruby ruby|text_i_want| test test"

I was thinking converting this line into an array, using the .split(//)
and keeping count of the pipe("|") character so that when it reaches the
3rd one, it reads the characters up till the 4th pipe(all in a do
iterator. So in essence, I would want to extract "text_i_want". When i
tried this method, I got stuck. Any ideas on how to move forward? Or an
easier solution than this? Thanks!

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Parsing text Cyril Jose <cyril_jose@ymail.com> - 2011-04-21 20:43 -0500
  Re: Parsing text John W Higgins <wishdev@gmail.com> - 2011-04-21 21:08 -0500
  Re: Parsing text 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-21 21:20 -0500
  Re: Parsing text Cyril Jose <cyril_jose@ymail.com> - 2011-04-21 22:15 -0500

csiph-web