Name Extraction

N

Newb Newb

Hi Friends

i have following string

(e-mail address removed)[email protected]

the above string has 2 email ids in it.but i need only names of it.

i want to extract only the names

jayabharathy

kannan


how can i implemend that
Kindly Let me Know
 
T

Tiago Nogueira

J

Jesús Gabriel y Galán

i have following string

(e-mail address removed)[email protected]

the above string has 2 email ids in it.but i need only names of it.

i want to extract only the names

Take a look at the split method in String:

http://www.ruby-doc.org/core/classes/String.html#M000818

For example:

irb(main):001:0> a = "(e-mail address removed)[email protected]"
=> "(e-mail address removed)[email protected]"
irb(main):006:0> a.split(/[@~]/)
=> ["jayabharathy", "angleritech.com", "Vs", "kannan", "angleritech.com"]

Hope this helps,

Jesus.
 
R

Robert Klemme

2009/1/27 Newb Newb said:
Hi Friends

i have following string

(e-mail address removed)[email protected]

the above string has 2 email ids in it.but i need only names of it.

i want to extract only the names

jayabharathy

kannan

Something like this can work, depends of course on the names that you
want to allow:

names = str.scan(/(\w+)@[a-z._-]+/i).flatten

Cheers

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,800
Messages
2,569,656
Members
45,400
Latest member
BuyZapGuardian
Top