Skip to content
Browse files

Javascript regex doesn't have \A or \z -- translate to ^ and $

  • Loading branch information...
1 parent 46b134a commit f22a3e62c06d67ef1c022c5a4ac5dcbd32fc2db7 Timothy Jones committed Oct 15, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/validatious-on-rails/validatious/validators/format_validator.rb
View
2 lib/validatious-on-rails/validatious/validators/format_validator.rb
@@ -23,7 +23,7 @@ def initialize(validation, options = {})
self.accept_empty = validation.options[:allow_nil]
self.fn = %{
#{self.class.validate_blank(validation)}
- return #{validation.options[:with].inspect}.test(value);
+ return #{validation.options[:with].inspect.gsub(/\\A/,'^').gsub(/\\z/,'$')}.test(value);
}
self.fn.freeze
end

0 comments on commit f22a3e6

Please sign in to comment.
Something went wrong with that request. Please try again.