You need to sign in to do that
Don't have an account?
Tasia Demuth 4
Do any of you know of a formula that will grab the emails from a format like this: John <john@esource.com>, Nick <nick@esource.com>
I am looking for a way to copy the emails from a calendar event and returning just the email string, rather than the name and email string.
Ideally it would look like: john@esource.com,nick@esource.com
I have been playing around with the TRIM and SUBSTITUTE functions but have been struggling to get it just right.
Any help would be greatly appreciated.
Thanks!
Tasia
Ideally it would look like: john@esource.com,nick@esource.com
I have been playing around with the TRIM and SUBSTITUTE functions but have been struggling to get it just right.
Any help would be greatly appreciated.
Thanks!
Tasia
Please refer below sample where its extracts only emil from part from give string. Though I am not sure where exectly you are using this might help Hope this helps! Please mark as best if it does
Thanks
First email and found first "<" ( no offset for the FIND )
Second email and found second "<" needs an offset ( FIND( '<',email__c)+1 ) repeated in each FIND ( searched text, source text , offset )
The formula works for just two emails (very restricted use). Apex is a better option like above but you also need a trigger.
More emails could be found with a formula but since the third email the formula becomes very complicated and for the fourth or fifth email that could already exceed the compiled maximum size permitted for a formula so it is not an interesting option excepted if you have always one or two emails.
In Apex, you can get hundreds of emails (possible for a mailing list) because there are the split method and methods for the regular expressions that are the main missing methods for the formula field.
As soon as we could write at least in a formula: SPLIT( email__c, "," , 1 ) for getting the first email and SPLIT( email__c, "," , 2 ) for the second one, etc, the problem will become a easier task but that is still missing.
String regExp = '<(.+?)>'; // between the parenthesis, there is the first capturing group (1).
.+? : means any characters (the period) (at least one (+)) after ( < ) up to the character after the '?' here ( > ) (the parenthesis are not used)
That is the real interest of the regular expressions indeed because there is an iterator ( m.find() ) that will browse all the emails that mach the format ( < anything between > )
It is just to know an alternative but we use the two solutions alternately.
The problem of the regular expressions is to understand what they are doing exactly contrary to indexOf and substring.
The regular expressions are usefull for complicated extractions where the uses of indexOf and substring become many in a code with many tests.