Jump to content

Modifying Melba's "recursive" file/folder search


Recommended Posts

  • Moderators

Spiff59,

Got you now - thanks. :)

Looking into your SREs to see how you build up the masks - why must the damned things be so difficult? :idea:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Spiff59,

I just use simple alphanumerics as filenames - why do people have to make it so complicated by using all these other characters? :)

This seems to fix it:

$s##clude_List_Mask = "(?i)^(" & StringReplace(StringReplace(StringRegExpReplace($s##clude_List, "(\^|\$|\.)", "\\$1"), "*", ".*"), "?", ".") & ")\z" ; Convert to SRE pattern

Oh how I love SREs! :idea:

M23

P.S. Actually, despite my moaning, I am very grateful for the input - always something to improve in any code (especially mine!). :(

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Spiff59,

I just use simple alphanumerics as filenames - why do people have to make it so complicated by using all these other characters? :(

This seems to fix it:

$s##clude_List_Mask = "(?i)^(" & StringReplace(StringReplace(StringRegExpReplace($s##clude_List, "(\^|\$|\.)", "\\$1"), "*", ".*"), "?", ".") & ")\z" ; Convert to SRE pattern

Oh how I love SREs! :idea:

M23

P.S. Actually, despite my moaning, I am very grateful for the input - always something to improve in any code (especially mine!). :)

I still like the one from a year ago :) It is very very similar, and has the ExcludeFolder parameter which can be useful (as in darkjohn20's last post) It also seems to be considerably faster in most cases. Edited by Spiff59
Link to comment
Share on other sites

  • Moderators

darkjohn20,

My final (at least for the moment! :) ) suggestion:

$s##clude_List_Mask = "(?i)^(" & StringReplace(StringReplace(StringRegExpReplace($s##clude_List, "(\^|\$|\.)", "\\$1"), "?", "."), "*", ".*?") & ")\z" ; Convert to SRE pattern

This gives me the same results as Spiff59's SREs - so it must be pretty good! :)

If you are interested, the 2 patterns come out like this (using "*.exe;*.dll*" as a filter):

Spiff59: (?i)\A(?!.*?[.]exe$|.*?[.]dll.*?$)
Melba23: (?i)^(.*?\.exe|.*?\.dll.*?)\z

They are basically identical:

(?i) - case insensitive

\A or ^ - start at beginning of string

(something|something_else) - use either|or (if you have multiple filters)

.*?[.]exe or .*?\.exe - smallest match of any number of characters followed by .exe

.*?[.]dll.*? or .*?\.dll.*? - smallest match of any number of characters followed by .dll followed by smallest match of any number of characters

$ or \z - end of string (either at end of each option or at the end of the option ()

Where we differ is the use of ?! (a zero-width negative lookahead) at the start of the () section - and there I cannot help because, although I know what it is, I have no idea why it is there! :idea:

; -----

Anyway, I seem to have been ignoring your original request since we got involved in the SRE discussions - my apologies. The dratted things have a sort of morbid fascination which draws you in ever further..... :)

Are you happy with the code now or are there things we could improve? Or would you prefer to use Spiff59's code instead? Please let me know. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...