Sijo Kg wrote:
> Hi
> I have a mailid like [EMAIL PROTECTED]@ As part of email validation
>
> I have to check it [EMAIL PROTECTED] So I did
>
> "[EMAIL PROTECTED]@@".split('@') So I get ['test','123.com'] But if it
> were [EMAIL PROTECTED] 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 = '[EMAIL PROTECTED]@@'
=> "[EMAIL PROTECTED]@@"
irb(main):015:0> a.split('@')
=> ["test", "123.com"]
irb(main):016:0> a = a + 'trash'
=> "[EMAIL PROTECTED]@@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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---