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

Find or Remove Item from a List where Value contains a wildcard

I have a list of files and I need PAD to look at this list and give me the list item that matches a wildcard ("SGC").

Is there a way to do this?

 

I tried "Remove item from list" with the Value of anything that doesn't end in "SGC" but it didn't like the syntax.

 

From experimenting, I've been able to parse a list with a regex wildcard but instead of giving me the list item where it found the "SGC" match, it simply stored the matched text. 

 

Suggestions appreciated 🙂 

5 REPLIES 5
yasunm02
Solution Sage
Solution Sage

Hi @MTIncPower 

Try this:

1) 'Get files in folder' to get the list of files (%Files% as output variable)

2) 'For each' CurrentItem in Files

3) 'If' %CurrentItem% (First operand) Does Not Contain (operator) 'SGC' (Second operand) then

4) 'Remove item from list' > Remove item by Value, With value = %CurrentItem%, From list = %Files%

5) 'End' (If's end)

6) 'End' (For each's end)

 

At the end, %Files% will have only items with 'SGC'. 

Daniel_Pa
Resolver II
Resolver II

Yasunm is right - I'll just add a screenshot for your convenience:

filter file list.png

Ahammad_Riyaz
Super User
Super User

Hi @MTIncPower ,

 

You can Try in this way

Try this:

 Get files in folder' to get the list of files (%Files1% as output variable)

For each CurrentItem in %Files1%

If' %CurrentItem% (First operand) Does Not Contain (operator) 'SGC' (Second operand) then

Remove item from list' > Remove item by Value, With value = %CurrentItem%, From list = %Files1%

End (If's end)

End (For each's end)

 

At the end, %Files1% will have only items with 'SGC'. 

 

If it works Please mark as a solution, so it will help even others also.

Regards

Ahammad Riyaz

MichaelAnnis
Super User
Super User

Are all the files in one folder to begin with?  The "Get files in folder" command has a file filter.

File filter *SGC should only pull in those files.  This says, it must end in SGC to be pulled in to the list.

Update:  Adjain is correct...unless the file ends in .SGC, you will need the * after.

adijain
Microsoft
Microsoft

Hi @MTIncPower You can use this directly 

adijain_0-1626471841577.png

Note the two * before and after SGC in the file filter parameter. (*SGC*)

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,407)