web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Check part of filename...
Power Automate
Answered

Check part of filename for specific values

(0) ShareShare
ReportReport
Posted on by 76

Hello,

 

We are receiving file attachments from email messages. The filename should be structured as follows:

 19934_2023_PD1.pdf (ComplexNR-Year-DocType)

 

By using three compose actions, the filename is checked against the following convention:

  • ComplexNR should contain: 5 digits
  • Year should contain: 4 digits
  • DocType should contain: 3 characters 

Values are separated by a _ dash .

 

For Doctype we have a a mutal agreement to use only the following doctypes in the filename: PD1, PO1, PO3, DB1 . Not everyone keeps to this. We would like to check if the value for doctype is valid. When not the filename does not contain one of the doc. type values we will send a notification to the sender of the message.

 

How can I validate the value of the doc type?

 

Flow:

To check the filename:

flow-check-filenamestructure.jpg

 

 

 
 
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @webmagic2022,

     

    Based on your description a Regex expression might be (just quickly tested this in regex101.com, not a regex expert over here 😁 )

     

     

    ^\d{5}(\s*|_)\d{4}(\s*|_)\s?(PD1|PO1|PO3|DB1)$

     

     

     

    You could use that either in one of the existing connectors, a custom connector you create yourself or a Office script.

     

    Below is an example with the Encodian connector

     

    match_regex.png

  • Verified answer
    fchopo Profile Picture
    8,003 Moderator on at

    Hi @webmagic2022 

    Another option would be the following:

    last-split.png

    Probably @Expiscornovus solution will go faster.

    Hope that helps!

    Ferran

  • webmagic2022 Profile Picture
    76 on at

    Thanks @fchopo this will do the job!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard