how to validate using regular expression using 1.name should be alpha numeric 2.min 5 characters and max 15 3."two alphabets followed by a number" format not allowed in the beginning .if any one have solution.pls send me -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > 1.name should be alpha numeric > 2.min 5 characters and max 15 > 3."two alphabets followed by a number" format not allowed in the > beginning .if any one have solution.pls send meCompletely untested. (Straight from brain to keyboard, so you will have to debug.) Not sure I understand #3 correctly, but if you *want* to match two letters followed by one or more alpha-numerics, something like this should work, but again, untested.. validates_length_of :whatever, :within => 5..15, :on => :create, :message => "must be between 5 and 15 characters long" validates_format_of :whatever, :with => %r{\A[a-zA-Z]{2}\w+ \Z}, :message => "must be blah blah blah." Good luck. Preston --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thans buddy -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---