You should use Regexp.escape
regex = /#{Regexp.escape(params[:text])}/
# in rails models/controllers with mongoid use:
# ::Regexp.escape(params[:text]) instead. ([more info][2])
You should use Regexp.escape
regex = /#{Regexp.escape(params[:text])}/
# in rails models/controllers with mongoid use:
# ::Regexp.escape(params[:text]) instead. ([more info][2])