[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

email => string

misiek

5/9/2006 6:21:00 PM

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
6 Answers

jonT

5/9/2006 9:09:00 PM

0

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

Robert Klemme

5/10/2006 8:35:00 AM

0

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

misiek

5/10/2006 5:07:00 PM

0

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 ?

misiek

5/10/2006 5:14:00 PM

0

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

abourick

9/30/2010 7:38:00 PM

0

lenel luc a ?crit :
> "abourick" <bourrique-anne@yahoo.br> a ?crit dans le message de news:
> FaydnZKhKdiPPD7RnZ2dnUVZ8qKdnZ2d@giganews.com...
>
>>>> L'exp?rience montre que ce sont les plus riches qui ?migrent, ceux qui
>>>> mangent ? leur faim, ont un boulot et des ressources financi?res
>>>> suffisantes pour payer les passeurs. Ceux qui n'ont pas de fric,
>>>> claquent du bec ou cr?vent de faim n'?migrent pas.
>>> Vous ?tes idiot.
>>
>> On prend le pari que c'est toi qui est con ?
>>
>>
>>> L'Emigration : seule alternative pour fuir la mis?re en Irlande
>>> http://www.guide-irlande.com/php/histoire-emigration-irlanda...
>>
>> Il y a 150 ans.
>
>
> "L'exp?rience montre "


On ne peut pas avoir d'exp?rience en 40 ans ?

Et si l'on y r?fl?chit bien qui avait l'argent pour payer la travers?e
aux USA ? Le pauvre et le mis?rable ou celui qui avait suffisamment de
bien pour payer la travers?e pour lui et sa nombreuse famille ? Les plus
riches sont partis aux USA, les plus mis?rables ont crev? sur place, en
Irlande !

Et vlan, qui a l'air supercon, ? cuculenel ?




abourick

9/30/2010 7:41:00 PM

0

Fustigator a ?crit :
> Vitae forma vocata abourick <bourrique-anne@yahoo.br> , die Thu, 30
> Sep 2010 21:18:09 +0200, in littera
> <pN6dnd59Woz_fznRnZ2dnUVZ8j-dnZ2d@giganews.com> in foro
> soc.culture.belgium(et aliis) vere scripsit quod sequitur:
>
>> Mich?le a ?crit :
>>> Filippeke : tu recommences ? te r?pandre lamentablement ici ???
>>
>> Tiens, la folle est "reviendue" !
>>
>> Alors, ce traitement aux hormones d'anchois avari?, comment ?a c'est
>> termin? ?
>
> MDR!!!


Cette pauvre Mich?le devrait prendre un repos prolong?, tr?s tr?s prolong?.