Extract email and date from field

General

Extract email and date from field

Hello. I am trying to extract the email and date from the field below. I do not want the " characters. Does anyone know how I can do this?




email
"person1@yahoo.com 05/05/2014'"
"person2@gmail.com 05/11/2014'"
"person0@yahoo.com 09/08/2014"'
"person3@gmail.com 03/08/2014"'

Thank you,

Sabrina

1 REPLY
Senior Apprentice

Re: Extract email and date from field

Hi Sabrina,

if the data actually looks like this, you can do some simple POSITION/SUBTRING/TRIM 

TRIM(LEADING '"' FROM SUBSTRING(x FROM 1 FOR  POSITION(' ' IN x))) AS email
TRIM(TRAILING '"' FROM SUBSTRING(x FROM POSITION(' ' IN x))) AS date

If it's more complicated and you're on TD14 you should switch to a regular expression (REGEXP_SUBSTR)