J
Jayan Jacob
I am trying to read the syntax(here the regular expression) frpm a file.
When I use /^[0-1]{1}$/ with "1" as subject it works but
/^[0-1]{1}[a-zA-Z]{1,25}$/ syntax for "1,abcd" , I have checked out on
the interpreter directly both works fine. I suppose I am messing up
something with the files, or gets or chomp or ..
Any help ?
def sanity_check(param)
filename = create_filename("Syntax",param) #this fn gets a
valid file name
if File.exist?(filename)
File.open(filename,"r+") do |syntaxfile|
syntax = syntaxfile.gets.chomp
return syntax.match(@newsettings.value)
end
end
return true # RETURN TRUE IF SYNTAX FILE NOT FOUND
end
==============================================================================
setprm_0.1.2.rb:149: return value
(rdb:1) v l
filename => "C:\\rubypgm\\Paramsyntax\\prm.102"
param => "102"
syntax => "/^[0-1]{1}[a-zA-Z]{1,25}$/"
value => nil
(rdb:1) n
setprm_0.1.2.rb:85: update_status(("\n Incorrect syntax ,
File not up
When I use /^[0-1]{1}$/ with "1" as subject it works but
/^[0-1]{1}[a-zA-Z]{1,25}$/ syntax for "1,abcd" , I have checked out on
the interpreter directly both works fine. I suppose I am messing up
something with the files, or gets or chomp or ..
Any help ?
def sanity_check(param)
filename = create_filename("Syntax",param) #this fn gets a
valid file name
if File.exist?(filename)
File.open(filename,"r+") do |syntaxfile|
syntax = syntaxfile.gets.chomp
return syntax.match(@newsettings.value)
end
end
return true # RETURN TRUE IF SYNTAX FILE NOT FOUND
end
==============================================================================
setprm_0.1.2.rb:149: return value
(rdb:1) v l
filename => "C:\\rubypgm\\Paramsyntax\\prm.102"
param => "102"
syntax => "/^[0-1]{1}[a-zA-Z]{1,25}$/"
value => nil
(rdb:1) n
setprm_0.1.2.rb:85: update_status(("\n Incorrect syntax ,
File not up