Rails 4 support

Changed ^ to \A and $ to \z