cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jeffern
New Member

Extract Substring between specified characters

Hey, all!

 

I’ll try to keep it brief, but I am fairly new to power automate and building flows. My questions are based off pdf file names that will be formatted as:

999-20220602-1–J 

 

I was able to set up my first substring to pull the first characters of an uploaded pdf into a specified column(RM), but the RM number can be between 1-4 digits so my current formula won’t work. Essentially I need a function to give me everything prior to the first hyphen.

 

My second issue is pulling the numbers between the first two hyphens and having that populate in the Receipt Date column. (I know the expression I made in the picture is nonsense, I was just burnt out from researching & was throwing poop at the proverbial wall😂)

 

From what I’ve read in other posts I may need to index, but as I said, I’m pretty new at this and would appreciate any help I can get!

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @Jeffern,

Do you want to extract substrings from the file name of a new created file?

Could you please share a bit more about your scenario?

 

Here is something about the substring:

1). To get the complete string prior to the first hyphen, you should combine the first() with the split():

first(split(outputs('Compose'),'-'))

Note that you could replace the outputs('Compose') with the file name from the dynamic content tab.

vqiaqimsft_0-1654493626407.png

2). To get each string split by the hyphen, you just need to use the variables() as below:

vqiaqimsft_2-1654495077616.png

variables('FileName')[1]

vqiaqimsft_1-1654494981767.png

Best Regards,
Qi

View solution in original post

2 REPLIES 2
Jeffern
New Member

.

91C05D65-9D6A-46CB-B0AB-9084F3D42093.jpeg

v-qiaqi-msft
Community Support
Community Support

Hi @Jeffern,

Do you want to extract substrings from the file name of a new created file?

Could you please share a bit more about your scenario?

 

Here is something about the substring:

1). To get the complete string prior to the first hyphen, you should combine the first() with the split():

first(split(outputs('Compose'),'-'))

Note that you could replace the outputs('Compose') with the file name from the dynamic content tab.

vqiaqimsft_0-1654493626407.png

2). To get each string split by the hyphen, you just need to use the variables() as below:

vqiaqimsft_2-1654495077616.png

variables('FileName')[1]

vqiaqimsft_1-1654494981767.png

Best Regards,
Qi

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (6,140)