I should have mentioned that for now we've decided on a solution.
In most of the cases, using a simple SSUB will extract the email
addreses. The only thing that SSUB doesn't work on is if a comma
is embedded in the name:
"tellef, karenf" <[email protected]>, [email protected]
In the above case, a SSUB(...1) would extract just the word "Tellef".
So I just test that the result contains a "@" and if it doesn't just
throw it away. The SSUB(..2) would extract just "karen" as the
name and they're fine with that. I could have added code for the
SSUB(...1) so get characters from the first ", but they said not to
bother right now.
We're going to update the list of frequent emails to get rid of those
commas and add code to prevent it from happening in the future.
Karen
-----Original Message-----
From: Karen Tellef <[email protected]>
To: rbase-l <[email protected]>
Sent: Fri, Oct 23, 2015 8:28 am
Subject: Re: [RBASE-L] - RE: Help with parsing email addresses?
Well yes and no. I actually want to KEEP the "name", not parse out
just the address. And actually the data is more complicated than what
I posted because I wanted to focus on one issue. The problem is that
the app (written by someone else) allows them to (a) type in email
addresses freehand, and/or (b) select them from a list of frequent emails
that sometimes have a name and sometimes do not. So for example,
my string can have values like below. I need to extract individual addresses
and they want me to keep the "name". This wasn't an issue in RMail for
7.6 because we sent them all on one line, but the newer RMail requires
each address on a different line. I might suggest that we totally redo the
method of them selecting an address. We can't upgrade until I have RMail
code redone so I have some time to wrestle with this.
[email protected]
[email protected], [email protected]
"karen tellef" <[email protected]>
"karen tellef" <[email protected]>, [email protected]
Nice data, huh?? I need to be off the allergic meds to tackle this one!
Karen
-----Original Message-----
From: Buddy Walker <[email protected]>
To: karentellef <[email protected]>
Sent: Thu, Oct 22, 2015 6:34 pm
Subject: [RBASE-L] - RE: Help with parsing email addresses?
Karen
Could you try something like this it should work with or without the comma
************************
SET VAR vLen INTEGER = 0
SET VAR vLoc INTEGER = 0
SET VAR vRem INTEGER = 0
SET VAR vEMail TEXT = NULL
SET VAR vEmail1 TEXT = NULL
--SET VAR vEMail1 = ('tellef, karen <[email protected]>')
SET VAR vEMail1 = ('karen tellef <[email protected]>')
IF vEMail1 CONTAINS '<' THEN
SET VAR vLen = (SLEN(vEMail1))
SET VAR vLoc = (SLOC(.vEmail1,'<'))
SET VAR vRem = (.vLen - .vLoc)
SET VAR vEMail = (SGET(.vEMail1,(.vRem -1),(.vLoc +1)))
ENDIF
SHOW VAR vEMail
****************************
Buddy
From: [email protected] [mailto:[email protected]] On Behalf Of Karen Tellef
Sent: Thursday, October 22, 2015 12:45 PM
To: Richardson, Jeff <[email protected]>
Subject: [RBASE-L] - Help with parsing email addresses?
Converting older RMail code into new RMail code. One of the things I have to
do is parse email addresses into individual RMail commands. I have no real
control over how it's getting to me.
If all data was like this, I could obviously parse using SSUB:
[email protected], [email protected]
Some of the data comes in with the "names" as part of the address. Again, this
would be easy, use SSUB
karen tellef <[email protected]>, mary smith <[email protected]
But guess what... Some of the names actually have a comma embedded:
tellef, karen <[email protected]>, mary Smith <[email protected]>
Sigh... Any suggestions on how I could program to get this into 2 lines for
an RMail send?
Thanks much!
Karen