how to find emails addresses into string
like :
string = "first@etc.com, second@etc.com"
string= "first@etc.com"
string = "second@etc.com"
the commas between addresses could be olso , colon , space or what ever,
I need to find addresses , do not look what is between of them, because
the point is that I need find addresses and replace the sign between of
them on commas, because maybe somebody put in some different sing like
space or, point , colon ...etc.
thanks
|
|
0
|
|
|
|
Reply
|
michaelaugustyniak (57)
|
5/9/2006 6:20:52 PM |
|
irb(main):012:0> "j@m.com; d@i.c,f@f.n".split(/[ ;,]/).select{|x|
x!=""}
=> ["j@m.com", "d@i.c", "f@f.n"]
Something like that? Just add / remove the delimiters you want to
support.
J
|
|
0
|
|
|
|
Reply
|
j823 (19)
|
5/9/2006 9:08:42 PM
|
|
jonT wrote:
> irb(main):012:0> "j@m.com; d@i.c,f@f.n".split(/[ ;,]/).select{|x|
> x!=""}
> => ["j@m.com", "d@i.c", "f@f.n"]
>
> Something like that? Just add / remove the delimiters you want to
> support.
> J
>
Alternatively use #scan - this might be more general and safer:
>> "j@m.com; d@i.c,f@f.n".scan /[a-z_-]+@[a-z_.-]+/i
=> ["j@m.com", "d@i.c", "f@f.n"]
Kind regards
robert
|
|
0
|
|
|
|
Reply
|
bob.news (3805)
|
5/10/2006 8:34:32 AM
|
|
Robert Klemme wrote:
> jonT wrote:
>
>> irb(main):012:0> "j@m.com; d@i.c,f@f.n".split(/[ ;,]/).select{|x|
>> x!=""}
>> => ["j@m.com", "d@i.c", "f@f.n"]
>>
>> Something like that? Just add / remove the delimiters you want to
>> support.
>> J
>>
>
> Alternatively use #scan - this might be more general and safer:
>
> >> "j@m.com; d@i.c,f@f.n".scan /[a-z_-]+@[a-z_.-]+/i
> => ["j@m.com", "d@i.c", "f@f.n"]
>
> Kind regards
>
> robert
the result of this "j@m.com; d@i.c,f@f.n".scan /[a-z_-]+@[a-z_.-]+/i
is => ["j@m.comd@i.cf@f.n"] ??? should not be commas between ?
|
|
0
|
|
|
|
Reply
|
michaelaugustyniak (57)
|
5/10/2006 5:07:14 PM
|
|
misiek wrote:
> Robert Klemme wrote:
>
>> jonT wrote:
>>
>>> irb(main):012:0> "j@m.com; d@i.c,f@f.n".split(/[ ;,]/).select{|x|
>>> x!=""}
>>> => ["j@m.com", "d@i.c", "f@f.n"]
>>>
>>> Something like that? Just add / remove the delimiters you want to
>>> support.
>>> J
>>>
>>
>> Alternatively use #scan - this might be more general and safer:
>>
>> >> "j@m.com; d@i.c,f@f.n".scan /[a-z_-]+@[a-z_.-]+/i
>> => ["j@m.com", "d@i.c", "f@f.n"]
>>
>> Kind regards
>>
>> robert
>
>
> the result of this "j@m.com; d@i.c,f@f.n".scan /[a-z_-]+@[a-z_.-]+/i
> is => ["j@m.comd@i.cf@f.n"] ??? should not be commas between ?
>
never mind sorry abou that
thanks for help , works perfect
|
|
0
|
|
|
|
Reply
|
michaelaugustyniak (57)
|
5/10/2006 5:14:29 PM
|
|
|
4 Replies
37 Views
(page loaded in 0.077 seconds)
|