Hi @npopova ,
Welcome to Power Automate! 🙂
It is possible to extract date from file name, and find a user email based on that to be used in an approval request. It is similar to what you already have in your flow, but it will require a little more complexity.
Before we start, I'm sharing some blog posts that I wrote about the topics discussed in this answer. You can refer to them for further reference:
- Working with variables in Power Automate: http://digitalmill.net/2023/07/03/working-with-variables-in-power-automate/
- Writing expressions in Power Automate: http://digitalmill.net/2024/02/27/writing-expressions-in-power-automate/
- For the '[0]' reference - Using loops and accessing array elements in Power Automate: http://digitalmill.net/2023/07/12/using-loops-and-accessing-array-elements-in-power-automate/
- Data Types in Power Automate: http://digitalmill.net/2023/08/03/data-types-in-power-automate/
- How to extract and clean texts with Power Automate: http://digitalmill.net/2023/08/12/how-to-extract-and-clean-texts-with-power-automate/
First, right after your trigger, you need to isolate the "XYZ" from "FILE XYZ". You can achieve it by combining some text expressions. Let's add a string variable for that, and after naming it and change its type to "String", click in "Value" input and then in the "Fx" button (highlighted in yellow below):

By doing that, you will be able to access the expression pane, where you can manipulate data in Power Automate in an approach very similar to an Excel formula:

Now write replace():

Position your mouse cursor between the parenthesis and then click in "Dynamic content" tab (highlighted in green), search for "name" (highlighted in blue) and then select the property "Name" from the list (highlighted in yellow). By just clicking in "Name", an expression will be added to the pane's input (underlined in red):

Still inside the parenthesis, but after the expression automatically added by Power Automate, add the following text: , 'FILE', ''

You just created a replace() expression, which is taking the 'FILE' text from your file name and replacing it for an empty string (''). Now surround this whole expression inside the parenthesis of a trim() expression:

The trim() is used to eliminate any extra blanks in the beginning or in the end of the string. Your expression is done, so you can just click in "Add", and your variable value will look like this:

Now you can add a "Search for a user" action, and pass the variable reference as "Search term":

This will search for the user profile in your tenant based on the name extracted from the file name.
Now you can add another string variable to store the user email. Repeat the process to add an expression, but at this time you will first add a reference to the dynamic content of the "body/value" property from the "Search for users" action (highlighted in yellow):

After Power Automate adds the expression, include the following text to its end: [0]['Mail'] (highlighted in yellow):

By using this expression, we are:
- Accessing a list (array) of the users from your tenant which names match with the value extracted from the file name (outputs('Search_for_users_(V2)')?['body/value'])
- Selecting the first user returned in this list ([0])
- Accessing the email property from this first user (['Mail'])
After saving the flow, I created this file for testing:

The flow ran successfully, extracting the user name from the file name (in yellow) and capturing it's email after the "Search for user" action (in green):

Let me know if it works for you or if you need any additional help!
-------------------------------------------------------------------------
If this is the answer for your question, please mark the post as Solved.
If this answer helps you in any way, please give it a like.
http://digitalmill.net/
https://www.linkedin.com/in/raphael-haus-zaneti/