You can use Regexp.newto create a regular expression from a string. Therefore, if your file contains only a regular expression that you can do:
regex = Regexp.new( File.read("somefile").chomp )
( chompto remove the trailing newline, if there is one, if you do not want this in regular expression)
source
share