Hi!

I suggest you very simple regex which can help find all emails:

[a-zA-Z0-9_.-]+@[a-zA-Z0-9.-]+\.\w{2,4}

In code:

File.open("file_with_emails.txt").each do |line|
line.scan(/([a-zA-Z0-9_.-]+@[a-zA-Z0-9.-]+\.\w{2,4})/) do
   puts "#{$1}";
end
end

On Tue, Oct 13, 2009 at 9:52 PM, Joshua Muheim <forum / josh.ch> wrote:
> Hi all
>
> I know this question is quite old, but I need to detect all the email
> addresses in a string. I guess I could use a RegEx, and I stumbled upon
> TMail that seems to do a great job validating emails. But I just can't
> find the RegEx that TMail uses...? Anybody does?
>
> Thanks for help
> Josh
> --
> Posted via http://www.ruby-forum.com/.
>
>