Why do Ruby's regular expressions use \A and \z instead of ^ and $?

Viewed 7562

I'm not a Ruby programmer, but as I was reading through the extensive Ruby on Rails security guide, I noticed this section:

A common pitfall in Ruby’s regular expressions is to match the string’s beginning and end by ^ and $, instead of \A and \z.

Does anyone know if this is this just a matter of aesthetics or something else? I ask because I've only used languages that use ^ and $.

1 Answers
Related