Hi all!
I am hoping someone can help me figure out this issue. I want to be able to extract (split) text (event subject) that could look like any of the below:
EXMAPLE 1: BLOGGS, Joe (Meeting - Office)
EXMAPLE 2: BLOGGS, Joe, DOE, Jane (Meeting - Offsite)
EXMAPLE 3: SMITH, Timothy John, PHILLIP, Fairmont, GRACE Sally-Louise (Monthly Update - Richmond Office)
The results I ultimately want are:
function1:
EXMAPLE 1: BLOGGS
EXMAPLE 2: BLOGGS, DOE
EXMAPLE 3: SMITH, PHILLIP, GRACE
function 2:
EXMAPLE 1: Joe
EXMAPLE 2: Joe, Jane
EXMAPLE 3: Timothy, Fairmont, Sally-Louise
I need the last name and first name in separate functions because they are used separately later on in the flow.
Currently, I have a function that works for EXAMPLE 1 -
Compose: split(triggerOutputs()?['body/subject'], ' ')[0]
which results in: BLOGGS,
Compose: split(outputs('SURNAME_(with_comma)'), ',')[0]
which leaves me with: BLOGGS
This works perfectly where there is only 1 name in the subject (as in EXAMPLE 1) . However I can't figure out how to extract this if there is more than 1 name.
Ultimately my question is - is there a way to extract only the ENTIRELY capitalized words? and/or is there a way to extract the first word immediately after a comma (even where there are multiple commas, like in EXAMPLES 2 and 3) ?