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

Filename format check

Hi,
What is the best way to check of the format of a filename complies to a standard?

Our standard looks like this: BC1234-BAM-XX-XX-BQ-CN-0085.docx
(Project-Originator-Level-Location-Type-Role-Number)

Project is alphanumerical  6 characters
Originator is alphanumerical 3 characters
Level, Location, Type and role are alphanumerical 2 characters
Number has a minimum length of 4 characters (so below 1000 leading zero's are added)

I was thinking to use find to check if the - appears 6 times and  substring to check if they are on the right position
substring(variables('filename'), 6,1 ) should be a - sign.

I'm not sure how to put this together.


 

 

3 REPLIES 3
DamoBird365
Super User
Super User

Hi @rolanddaane 

 

Flow doesn't yet support regular expressions, yet you can build something using Typescript/Office Scripts How to use Regex in Power Automate (tachytelic.net).  More recently, there is the option to create a C# Custom Connector, which might also suite your needs/requirements.

 

If neither apply, you could use the expression split(string,'-').  It will return an array of objects split on the -.  You can then check each of the objects as you require?

 

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


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

 

rolanddaane
Frequent Visitor

I subscribed and already liked your intro video.
Are you based in the UK?

Hi @rolanddaane 

 

I am indeed - North East Scotland!

 

Damien

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Users online (2,554)