Looks like here you need the initial string to be in single quotes (refer this page)
>> str="[\w\s]+"
=> "[\\w\\s]+"
>> Regexp.new str
=> /[\w\s]+/
Looks like here you need the initial string to be in single quotes (refer this page)
>> str="[\w\s]+"
=> "[\\w\\s]+"
>> Regexp.new str
=> /[\w\s]+/