Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extract email address from string

Status
Not open for further replies.

grom71

IS-IT--Management
Oct 23, 2003
56
0
0
GB
Hi,
I have a email display name database field which I need to extract the email address from...
They all end with the email address as shown below:
John Smith (5JA) Hinckley & Bosworth PCT(john.smith@lnds.nhs.uk)

I need to extract backwards from the right removing the brackets..
I'm a bit stuck with this one, please help !
Steve
 
Hi

There is a function in crystal called InStrRev, which will help you find the position of the opening bracket before the email address. Try using this in conjunction with the 'Mid' and 'Len' functions and you shouldn't have too much trouble.

Cheers


Geraint

The lights are on but nobody's home, my elevator doesn't go to the top. I'm not playing with a full deck, I've lost my marbles. Barenaked Ladies - Crazy
 
Try:

whileprintingrecords;
stringvar email :=trim(
mid({table.field},instrrev({table.field},"(")+1));
left(email,len(email)-1)

-k
 
WOW that was quick...
Thankyou both soooooo much ! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top