From: "Sandor Szücs" Date: 2008-07-15T18:50:17+09:00 Subject: Re: the Regular exp read from file not matching !! On 15.07.2008, at 05:07, Jay Jkb wrote: > some explanation on why? , would be great . In my opinion it's a String vs. RegExp problem. Your rdebug output said that your syntax variable was a String, or?: > (rdb:1) v l > filename => "C:\\rubypgm\\Paramsyntax\\prm.102" > newsettings => "1abcd" > param => "102" > syntax => "/^[0-1]{1}[a-zA-Z]{1,25}$/" syntax has doublequotes and is a String here (maybe a hint or just output?). However if you read from file you get a String not an Regexp you want to have a new Regexp so you have to use Regexp.new or /"string"/. In a test the String don't match like a Regexp: irb> syntax="/^[0-1]{1}[a-zA-Z]{1,25}$/" irb> newsettings="1abcd" irb> syntax.match(newsettings) => nil irb> syntax2=/^[0-1]{1}[a-zA-Z]{1,25}$/ irb> syntax2.match(newsettings) => # you want: irb> Regexp.new("/^[0-1]{1}[a-zA-Z]{1,25}$/") => /\/^[0-1]{1}[a-zA-Z] {1,25}$\// or what you did: > /#{syntaxfile.gets.chomp}/.match(@newsettings.value) It's a Regexp so it works as expected. hth. regards, Sandor Szücs -- P.S. sorry for my missinterpretation of your problem on my first answer.