The difference between ^ $ and \A \z pairs is that the first matches the line-by-line, therefore requires multiline mode enabled to proper work, and the second matches the whole string, from begin to end consequently. Please see the definitions in ruby docs.

Email codedump link for ArgumentError: The provided regular expression is using multiline anchors (^ or $)