How i can get the all selected repeated values from an email

when I will receive the email like as the below thread, i want to get the data values with keywords ([EXTMSG],POD and ABCDCOM ). How can I get all the values that have ([EXTMSG],POD and ABCDCOM). And sometimes the user reply the value once and sometimes twice or more. i am using regex in which i can get only the top one value value not the remaining.
email 5:
App

[EXTMSG] 434343sdf454
whats
POD 1324182333

ABCDCOM srgdgg6446645
there
Manually

POD 13241000818
[EXTMSG] ub402262000534
ABCDCOM 090075600001
POD 13241818
[EXTMSG] ub4022620534
ABCDCOM 090075601
Tayyab Imtiaz

From: Muhammad Tayyab Imtiaz
Sent: Friday, November 24, 2023 4:37 PM
To: Muhammad Tayyab Imtiaz
Subject: RE: ONLY_SUBJECT

email 4:
ABCDCOM srgdgg6446645
there
[EXTMSG] 434343sdf454
whats
POD 1324182333
App
Manually
[EXTMSG] 434343sdf454
whats
POD 1324182333

ABCDCOM srgdgg6446645
there
Manually
POD 13241818
[EXTMSG] ub4022620534
ABCDCOM 090075601

Tayyab Imtiaz

From: Muhammad Tayyab Imtiaz
Sent: Friday, November 24, 2023 4:36 PM
To: Muhammad Tayyab Imtiaz
Subject: RE: ONLY_SUBJECT

email 3:
POD 13241828
[EXTMSG] ub40226277774
ABCDCOM 753977553445

[EXTMSG] 434343sdf454
whats
POD 1324182333

ABCDCOM srgdgg6446645
there
Manually

Tayyab Imtiaz

From: Muhammad Tayyab Imtiaz
Sent: Friday, November 24, 2023 4:36 PM
To: Muhammad Tayyab Imtiaz
Subject: ONLY_SUBJECT

email 2:
POD 13241818
[EXTMSG] ub4022620534
ABCDCOM 090075601

Tayyab Imtiaz

From: Muhammad Tayyab Imtiaz
Sent: Friday, November 24, 2023 4:36 PM
To: Muhammad Tayyab Imtiaz
Subject: ONLY_SUBJECT

email 1:

POD 13241818
[EXTMSG] ub4022620534
ABCDCOM 090075601

Tayyab Imtiaz

Hi @tayyabimtiaz1

Can you try this regex to get keywords

(?<=[EXTMSG]\s*)\S+|(?<=POD\s*)\S+|(?<=ABCDCOM\s*)\S+

Where i can define them in the loop or outside the loop??

Outside the Loop

  • Matches Activity (to get all occurrences)

    • Input: emailContent (the variable containing your email text)
    • Pattern: “(?<=[EXTMSG]\s*)\S+|(?<=POD\s*)\S+|(?<=ABCDCOM\s*)\S+”
    • Result: matchCollection
  • For Each Activity (to iterate through the matches)

    • TypeArgument: System.Text.RegularExpressions.Match
    • Values: matchCollection
      • Inside the loop:
        • Assign each match.Value to a string variable or add it to a collection

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.