I am keeping a regular expression in the following variable -
pattern_text = "/\A([^@\s]+)@((?:c-d+\.)+(in|com))\z/".
"mailbox@c-d.in".match?(/\A([^@\s]+)@((?:c-d+\.)+(in|com))\z/) => returns true
Regexp.new(pattern_text) => returns /\/A([^@ ]+)@((?:c-d+.)+(in|com))z\//
"mailbox@c-d.in".match?(Regexp.new(pattern_text)) => returns false
Saving this regular expression to my database automatically strips the \.
The regex validator that I receive arrives as a string. Why doesn't that version work?