cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PrashantCFC1
Frequent Visitor

Split multiple lines and return a particular text

Hello,

Could someone tell me how can I get only a particular information from a text field using the split function. For example, I have a text field which contains multiple lines as such :

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

Enectus et netus et malesuada fames ac turpis egestas

 

I want to get only the data of the second line (from "Excepteur" to "laborum") and not anything after. How do I do this using the split function?

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
RezaDorrani
Dual Super User II
Dual Super User II

Hi @PrashantCFC1 

 

ClearCollect(colnew, Split(Textfield.Text,Char(13)));

 

Last(FirstN(colnew,3)).Result - this should give you the result

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

5 REPLIES 5
RezaDorrani
Dual Super User II
Dual Super User II

Hi @PrashantCFC1 

 

ClearCollect(colnew, Split(Textfield.Text,Char(13)));

 

Last(FirstN(colnew,3)).Result - this should give you the result

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

Hi @RezaDorrani ,

Thanks for your suggestion. However, the above text was just an example. The number of characters are unknown in each line. In that case would I be able to split by line?

Hi @PrashantCFC1 

 

Yes it would

As long as you have the same pattern

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi @RezaDorrani 

I'm having problem using split function:

I have this label1.text that contain text:
"(01)00884450005156(17)220228(10)K1527906"

text3.png

I want to split it by the bracketed number and store into 3 different label.

 

ie:

label1.text = 00884450005156

label2.text = 220228
label3.text = K1527906

I also try to use the split function like this on label3.text, but it give error: Expected Text Value.
Split(Label.Text, "(10)").Result

What should i do?

Can you help me?

Thanks,

pytbyt

@PytByt  You're better off looking at the IsMatch and related functions.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,553)