I solved this with regex:
/(([0-9]{4}[-\s]{0,3}){3}(([0-9]{4}){1}))/
Before save to Database, "Strip everything but numerics" :-)
Check this regex here:
___
http://cosmoverbal.net
On Sep 14, 8:54 pm, Bryan <[EMAIL PROTECTED]> wrote:
> Can someone explain their thought process on putting the credit card
> string validation process together? Conceptually, I understand what
> is going on, however, I'm not getting the how I would make my custom
> validation based on:
>
> "User can enter the credit card format in the following format. The x
> has to be numeric value.
> xxxx-xxxx-xxxx-xxxx (format #1)
> xxxx xxxx xxxx xxxx (format #2)
> xxxxxxxxxxxxxxxx (format #3)"
>
> I know I would use
> validate_format_ofhttp://www.railsbrain.com/api/rails-2.1.0/doc/index.html?a=M001743&na...
>
> I'm sure this is probably simple for most of you but a push in the
> right direction will help.
>
> Thanks!
>
> b
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---