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?
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?
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
Why don't you point out the deficiencies with the answers given in your
previous thread where you asked the exact same question? The proper
place to do that would be, wait for it...your previous thread.
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
Why don't you point out the deficiencies with the answers given in your
previous thread where you asked the exact same question? The proper
place to do that would be, wait for it...your previous thread.
Also, despite what you may think, this forum isn't a free programming
service.