Ruby text

Soldato
Joined
24 Nov 2002
Posts
16,378
Location
38.744281°N 104.846806°W
Using Regexp one can locate a string within a text file I want... however, how do I copy the data from the following line?

E.g.

#Monkey's Name:
Gregory

I would want to extract Gregory, not "#Monkey's Name:"....

I know it's simple but I can't thinK!
 
Cool!

How would I amend the above so that it would cope for any "# Variable :".

I.e. it would read the entire file and store the line under each "# Variable :" in tab delimindated format.

So,

# Variable1:
blah1

# Variable2:
blah2

# Variable3:
blah3

Would merely become "blah1 blah2 blah3".
 
Okay... new problem.

It appears that it isn't JUST the single line after the # Variable..

It could be:

# Variable1:
blah

#Variable2:
blah
bob
dee

#Variable3:
etc..

So I suppose the logical thing is to only extract the text 'between' the #'s?
 
Back
Top Bottom