Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
newbie qustion
Ricardo Furgeson
8/1/2006 10:34:00 PM
I'm trying to parse a file that looks like this:
text....
text....
numbers....
IDS_SOMETHIGN_SOMETHING "giving you cookies in a sec"
IDX_SOMETHING_SOMETHIGN
IDY_SMOTHIENG_SOMETHIGN_SOMTHIGN "HELO world"
ID_ONE_THING "hello how are you"
ID_ONETHINGTOO "give me a number"
ID_ONEMORE_THING_ANDMORE "this are strings"
I'm trying to create a hash table but i'm not sure what's wrong with my
delimeters:
class Parser
table = { }
IO.foreach('resurcefiletest') { |line|
if line =~ /^ID* (.*?) = \s* " (.*?) "/x
#if line =~ /^ \s* " (.*?) " \s* = \s* " (.*?) "/x
table[ $1 ] = $2
end
}
#puts table["StaplingTitle"]
p table
end
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
newbie qustion
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password