cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
soooofunny
Level: Powered On

I do not know how to extract data line by line from the text.

Hi, Guys.

 

The system sends an email in the following format.

I want to take out this line by line and process it.

Records are determined by the order of date and time, error code, ID, and message.

This is one pack of data.

 

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
 
 
2019/06/11 18:57:30 System_error_5_occurred 
525866,AABBCCDDEEFFGGHH
 
2019/07/19 21:49:13 System_error_5_occurred 
535896,OOKKOOOONJJJOOOO
 
2019/08/25 13:38:34 System_error_5_occurred 
596322,PPKKOKKKKKKMNJJK
 
2020/01/01 13:30:27 System_error_5_occurred 
574147,OOKKAAAAAAAAAAAA
 
 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

 

However, the error code is followed by a new line.

Also, this text may be 1 line or 10 lines.In other words, it is variable.

 

First of all, I do not know the deletion of the line feed is in trouble.

Next, I do not know how to analyze one row at a time and repeatedly acquire data.

(Can Microsoft Flow be used as a regular expression?)

aa.PNG

Please help me out. Thank you.

4 REPLIES 4
Dual Super User
Dual Super User

Re: I do not know how to extract data line by line from the text.

Hi @soooofunny 

 

Regex is currenlty not supported directly as a flow action. However, there is a premium connector and a paid service that has this action and is supported in Flow. More details here:

https://plumsail.com/docs/documents/v1.x/flow/how-tos/documents/use-regex-match-to-extract-values.ht...

 

You can raise an idea to include the Regex feature here and you can share your comments, upvote the idea too:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

Now coming to the email parsing, I see that the email is pretty structured and using some string manipulations, the data can be extracted. To start with, you can first split the body of the email over the enter key and get the lines of the email in an array and then perform further string operations on that. 

 

Please see a screenshot to split the body of the email at every new line here: 

emails.PNG

 

Here, I am taking the body of the email, a string variable with an empty line (initialise a variable as a string and in the value part just hit an enter) and initialiseing an array variable and here i am splittign the body over the enter variable. If you are using the when an email arrives trigger, you can use the body of the trigger and split over the enter variable to get each line as an element in an array and further analyse it. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

soooofunny
Level: Powered On

Re: I do not know how to extract data line by line from the text.

Hi. @yashag2255 

 

Thank you for teaching me a lot.

Regular expressions can only be used for paid services.

For the time being, I would like to make as much as possible with the free service.

 

Sorry...Though I taught you so much, I can not understand well.

Especially about the part of "Split function".

Is the usage as shown in the image wrong?

1.PNG

 

For example, such processing is assumed.

(1) "2019/06/11 18:57:30 System_error_5_occurred 525866, AABB CCD EEF FGGHH " Take out the line and go to the next process.

(2) When (1) is over, "2019/07/19 21:49:13 System_error_5_occurred Take out 535896, OOKKOOOONJJJOOOO "to the next processing.

(3) Repeat as long as there is a line.

 

I'm sorry to be so inquisitive.

Thanks.

Community Support Team
Community Support Team

Re: I do not know how to extract data line by line from the text.

Hi @soooofunny ,

 

Do you want to extract content from email body?

 

Is the email body always in the same format?

 

If so, please check the following thread for a reference:

https://powerusers.microsoft.com/t5/General-Flow-Discussion/Using-a-flow-to-extract-email-body-detai...

 

we could get content from email body using WDL functions, you could know more about WDL functions at here:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
soooofunny
Level: Powered On

Re: I do not know how to extract data line by line from the text.

Hi. @v-yamao-msft .

 

Yes. That's right. I want to extract from the body of the mail.

It is a mail of the same format except the number of logs is different.

 

I checked the hyperlink destination that taught me.

I was able to pull out the "date and time" data in the way I was taught.
However, the number of records is different each time.
There are 4 lines in the sample, but there are 1 or 10 lines.
Although it is necessary to repeat, Microsoft Flow can not find a function that counts strings.
 
How do I get it to loop?
I'm sorry for asking you many times.
Thanks.

 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 4 members 5,340 guests
Recent signins:
Please welcome our newest community members: