How to check that the number is not toll-free?

I'm trying to check that the number is not free, but not sure how to install this via the baked checkout helpers.

Here's what I've done so far:

validates :local_phone, :format => { :with => /^(\+?1)?(8(00|55|66|77|88)[2-9]\d{6})$/, :message => "cannot be a toll-free number" }

      

However, he confirms that the number is free. I tried to switch it! but to no avail. Before writing my own validates_with class, I thought it would be best to ask.

+3


source to share


1 answer


How to check that the number is not toll-free? Just call this number and find out :-)

He has already received a response (see comment above). I'm just redirecting it again to prevent this question from showing up in the No Answer section.



validates :local_phone, :format => { 
   :with => /^(?!(+?1)?(8(00|55|66|77|88)[2-9]\d{6})).{10}$/, 
   :message => "cannot be a toll-free number" }

      

+1


source







All Articles