From: Gavin Sinclair Date: 2002-08-26T22:40:49+09:00 Subject: Re: Newbie Regexp question ----- Original Message ----- From: "Torsten R�ger" > Moi, > I'm new to ruby and even to regular expression, so I fear these might be > super simple. 2 Questions > > I have a string (actually a java inner class file name) like > >name = "com.foo.Outer$Inner.class" > > and want to replace $ with \$ (for the shell) name.gsub(/\$/, '\$') > > And the other one is with a line (from a config file) like > line = "option.name = "value 1" "value 2" " > > and I'd like an expression that > 1 gets me the stuff after the = , and whatever I do the = is always part > of the result > 2 an expession that I could use with split that gets an array [ > "option.name","value 1" , "value 2"] 1. value = /=.*$/.match(line)[0] (see ri Regexp.match and ri MatchData) 2. value.scan(/"(.*?)"/).flatten -> ["value 1", "value 2"] > Thanks > Torsten > Regards, Gavin