0

I have tried this

validates :name, format: { with:  /^[a-zA-Z0-9 ]*$/ }

but its giving error regular expression is using multiline anchors (^ or $)

Please guide me how to solve this.

Pavan
  • 33,316
  • 7
  • 50
  • 76

1 Answers1

1

Try this:

validates :name, format: { with:  /\A[a-zA-Z0-9 ]+\z/ }

hope this will help you.

Dinshaw Raje
  • 933
  • 1
  • 12
  • 33
  • 2
    for more details go through this http://stackoverflow.com/questions/24919330/the-provided-regular-expression-is-using-multiline-anchors-or – Dinshaw Raje Jun 30 '15 at 10:52