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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Top Solution Authors
Top Kudoed Authors
Users online (4,713)