Improve security of regexes to satisfy Rails 4.

Rails 4 was failing with this message:

"The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?