Hi I have a mailid like test-M/39claqbm0@public.gmane.org@ As part of email validation I have to check it user-M/39claqbm0@public.gmane.org So I did "test-M/39claqbm0@public.gmane.org@@".split(''@'') So I get [''test'',''123.com''] But if it were test-M/39claqbm0@public.gmane.org the expected validation is correct But the lase two @ signs are not recognized by split So how can check that after 123.com still there is @ sign and declare my validation as failed? Sijo -- 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 -~----------~----~----~----~------~----~------~--~---
Sijo Kg wrote:> Hi > I have a mailid like test-M/39claqbm0@public.gmane.org@ As part of email validation > > I have to check it user-M/39claqbm0@public.gmane.org So I did > > "test-M/39claqbm0@public.gmane.org@@".split(''@'') So I get [''test'',''123.com''] But if it > were test-M/39claqbm0@public.gmane.org the expected validation is correct But the lase two @ > signs are not recognized by split So how can check that after 123.com > still there is @ sign and declare my validation as failed? > > Sijo >I can''t explain why it doesn''t recognize but you could add something to the end of the address and split. irb(main):014:0> a = ''test-M/39claqbm0@public.gmane.org@@'' => "test-M/39claqbm0@public.gmane.org@@" irb(main):015:0> a.split(''@'') => ["test", "123.com"] irb(main):016:0> a = a + ''trash'' => "test-M/39claqbm0@public.gmane.org@@trash" irb(main):017:0> a.split(''@'') => ["test", "123.com", "", "trash"] irb(main):018:0> Hope this helps. Cheers, Mohit. 11/7/2008 | 5:29 PM. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi This is not the required solution Suppose the user enters test-M/39claqbm0@public.gmane.org@@ or test-M/39claqbm0@public.gmane.org@ what happens? Since we cant insists that there should be value after @ or @@ Thanks Sijo -- 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 -~----------~----~----~----~------~----~------~--~---
On Fri, Nov 7, 2008 at 8:39 PM, Sijo Kg <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi > This is not the required solution Suppose the user enters > test-M/39claqbm0@public.gmane.org@@ or test-M/39claqbm0@public.gmane.org@ what happens? Since we cant insists > that there should be value after @ or @@Use tmail to validate your email :) It will raise an exception on basically anything except a correct address. And I would recommend not using an ''@'' symbol to symbolize anything in an email address. It is the key component that separates the local from the domain part of the email address and you will always run into problems. You can see how here: http://www.lindsaar.net/2008/4/14/tip-4-detecting-a-valid-email-address>> require ''tmail''=> true>> TMail::Address.parse(''test-M/39claqbm0@public.gmane.org@@'')TMail::SyntaxError: parse error on token "@" from parser.y:379:in `on_error'' from (irb):2:in `_racc_yyparse_c'' from parser.y:375:in `scan'' from parser.y:375:in `parse_in'' from racc/parser.rb:152:in `_racc_yyparse_c'' from racc/parser.rb:152:in `__send__'' from racc/parser.rb:152:in `yyparse'' from parser.y:366:in `parse'' from parser.y:344:in `parse'' from /Library/Ruby/Gems/1.8/gems/tmail-1.2.3.1/lib/tmail/address.rb:84:in `parse'' from (irb):2>> TMail::Address.parse(''test-M/39claqbm0@public.gmane.org@'')TMail::SyntaxError: parse error on token "@" from parser.y:379:in `on_error'' from (irb):3:in `_racc_yyparse_c'' from parser.y:375:in `scan'' from parser.y:375:in `parse_in'' from racc/parser.rb:152:in `_racc_yyparse_c'' from racc/parser.rb:152:in `__send__'' from racc/parser.rb:152:in `yyparse'' from parser.y:366:in `parse'' from parser.y:344:in `parse'' from /Library/Ruby/Gems/1.8/gems/tmail-1.2.3.1/lib/tmail/address.rb:84:in `parse'' from (irb):3>> TMail::Address.parse(''test-M/39claqbm0@public.gmane.org'')=> #<TMail::Address test-M/39claqbm0@public.gmane.org> -- http://lindsaar.net/ Rails, RSpec and Life blog.... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Thanks for the reply..But when i tried from script/console reslut was like TMail::Address.parse(''test-M/39claqbm0@public.gmane.org@'') => #<TMail::Address test-M/39claqbm0@public.gmane.org@>>> TMail::Address.parse(''test-M/39claqbm0@public.gmane.org@@'')=> #<TMail::Address test-M/39claqbm0@public.gmane.org@> Why this happens? Sijo -- 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 -~----------~----~----~----~------~----~------~--~---
On Fri, Nov 7, 2008 at 9:16 PM, Sijo Kg <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> Thanks for the reply..But when i tried from script/console reslut > was like > > TMail::Address.parse(''test-M/39claqbm0@public.gmane.org@'') > => #<TMail::Address test-M/39claqbm0@public.gmane.org@> > >> TMail::Address.parse(''test-M/39claqbm0@public.gmane.org@@'') > => #<TMail::Address test-M/39claqbm0@public.gmane.org@> >What version of TMail is that?>> TMail::VERSION::STRING=> "1.2.3" Mikel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
In my current project, I''m using the regexp from http://www.regular-expressions.info/email.html with validates_format_of to validate email addresses. Regards, Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi When in console typed TMail::VERSION::STRING I got error NameError: uninitialized constant TMail So wont Tmail be installed as part of Rails? Sijo -- 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 -~----------~----~----~----~------~----~------~--~---
Hey yo - On 13-Nov-08, at 11:14 PM, Craig Demyanovich wrote:> In my current project, I''m using the regexp from http://www.regular-expressions.info/email.html > with validates_format_of to validate email addresses. > > Regards, > CraigChecked out this baby? http://ex-parrot.com/~pdw/Mail-RFC822-Address.html (I''m using something similar to Craig''s - wonder if the above would crack open a bug in ruby''s regexp? J --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Another contender... I use this one: http://tfletcher.com/lib/rfc822.rb usage: validates_format_of :email, :with => RFC822::EmailAddress On Nov 14, 8:50 am, Jodi Showers <j...-BOB1p6JRLoAV+D8aMU/kSg@public.gmane.org> wrote:> Hey yo - > > On 13-Nov-08, at 11:14 PM, Craig Demyanovich wrote: > > > In my current project, I''m using the regexp fromhttp://www.regular-expressions.info/email.html > > with validates_format_of to validate email addresses. > > > Regards, > > Craig > > Checked out this baby? > > http://ex-parrot.com/~pdw/Mail-RFC822-Address.html > > (I''m using something similar to Craig''s - wonder if the above would > crack open a bug in ruby''s regexp? > > J--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---