Regular expressions for filename searches & file sorting
Moderators: fgagnon, nikos, Site Mods
Regular expressions for filename searches & file sorting
Hi Nikos, FG & everybody,
If ever you have a lazy few weeks and are wondering what marvelous new feature might bring joy and happiness to at least one user, the following two items have been at the top of my wish list for years now.
1) Finding a list of files using a RE on the filename
A checkbox "RE" for the input box "Named:" on the "Find files or folders" window (<ctrl/F>).
2) Sorting files based on a RE-selected part of the filename
I'm not sure where one would put this in X2's interface, but I'd love to be shown a list of files or folders in an order determined by a portion of the filename. For example, I've got several hundred directories of photos collected and organized by the family. Taking a subset, their lexical order is:
Avoriez-Helen&Jamie Jan 1976
Biaritz 1998
Brittany trip Jun 1992
English canals Sep 1993
Dome Vermont 1971
Helen-Scott wedding Jun 1991
Hillside landscapes 2003
Hillside landscapes, 1979
Hillside, Helen Nov 1981
Oregon 1987
If I could specify a sorting RE of "\b\d{4}\b" (with whatever parentheses might be required by Windows' RegEx facility for returning the matching substring), X2 could show me the this list in chronological order.
Dome Vermont 1971
Avoriez-Helen&Jamie Jan 1976
...
Biaritz 1998
Hillside landscapes 2003
I could rename 'em all (& probably will to give the collection a bit more structure), but the same facility would then become useful if I wanted to view the list in or order of the locale or the people.
Et voilà. Wish list réactualisée. Hoping everybody is well & with best regards, Jamie
If ever you have a lazy few weeks and are wondering what marvelous new feature might bring joy and happiness to at least one user, the following two items have been at the top of my wish list for years now.
1) Finding a list of files using a RE on the filename
A checkbox "RE" for the input box "Named:" on the "Find files or folders" window (<ctrl/F>).
2) Sorting files based on a RE-selected part of the filename
I'm not sure where one would put this in X2's interface, but I'd love to be shown a list of files or folders in an order determined by a portion of the filename. For example, I've got several hundred directories of photos collected and organized by the family. Taking a subset, their lexical order is:
Avoriez-Helen&Jamie Jan 1976
Biaritz 1998
Brittany trip Jun 1992
English canals Sep 1993
Dome Vermont 1971
Helen-Scott wedding Jun 1991
Hillside landscapes 2003
Hillside landscapes, 1979
Hillside, Helen Nov 1981
Oregon 1987
If I could specify a sorting RE of "\b\d{4}\b" (with whatever parentheses might be required by Windows' RegEx facility for returning the matching substring), X2 could show me the this list in chronological order.
Dome Vermont 1971
Avoriez-Helen&Jamie Jan 1976
...
Biaritz 1998
Hillside landscapes 2003
I could rename 'em all (& probably will to give the collection a bit more structure), but the same facility would then become useful if I wanted to view the list in or order of the locale or the people.
Et voilà. Wish list réactualisée. Hoping everybody is well & with best regards, Jamie
- Alec_Burgess
- Member
- Posts: 13
- Joined: 2006 Oct 20, 03:09
Regex for rename too?
I wasn't sure whether the BULK-rename facility could use regex FIND and REPLACE in constructing the proposed new name.1) Finding a list of files using a RE on the filename
A checkbox "RE" for the input box "Named:" on the "Find files or folders" window (<ctrl/F>).
2) Sorting files based on a RE-selected part of the filename
I searched through the PDF manual and found description of regex syntax in an Appendix but conspicuously absent is any mention of using these for either FIND/FILTER or RENAME.
Am I correct that this is the current state of play?
Any chance it's already on the to-do list?
Failing that I'll go find theRename :(
I asked because I'm temporarily working on a new computer that has none of the tools I'm used to working with. One of the first I d/l'd was Xplorer and was hoping to avoid getting a separate renaming program.
Regards .. Alec
Re: Regular expressions for filename searches..
*bump*JamieG wrote:...
1) Finding a list of files using a RE on the filename
...
Sorry to do that, but I would really like this feature and it doesn't sound too difficult to implement (since RegEx functionality already exists when matching on the contents of files).
I will say that I never thought about JamieG's second feature request, but it certainly would be neat and I'd probably use it if it did happen to come into existence.
-Thracx
"Man wants to know, and when he ceases to do so, he is no longer a man."
-Fridtjof Nansen
"Man wants to know, and when he ceases to do so, he is no longer a man."
-Fridtjof Nansen
Then how about one of those fancy 'registry only tweaks' that function as a global checkbox?nikos wrote:if i was to add this, then all the 000s places where filename wildcards are accepted would have to be changed so that there's a checkbox for "regular expression", messing up the gui for probably just you and the other 2 guys in this thread
That way the 2 of us can turn it on and always use RegEx, and everyone else just lives on like normal
-Thracx
"Man wants to know, and when he ceases to do so, he is no longer a man."
-Fridtjof Nansen
"Man wants to know, and when he ceases to do so, he is no longer a man."
-Fridtjof Nansen
Make that threenikos wrote:... you and the other 2 guys in this thread
Decent regular expression support (especially in renaming) is a major feature for me. I almost chose a competitor due to this (but due to the restrictive license I ended up with x2).
In a tool such as this, aiming at an audience that seek more advanced features, this should not be considered a bloat function or unnecessary clutter.
Otherwise I find x2 an excellent tool and a true time saver.
/Bard
- FrizzleFry
- Platinum Member
- Posts: 1241
- Joined: 2005 Oct 16, 19:09
http://www.regular-expressions.info/freespacing.html
Likewise, grouping modifiers cannot be broken up. (?>atomic) is the same as (?> ato mic ) and as ( ?>ato mic). They all match the same atomic group. They're not the same as (? >atomic). In fact, the latter will cause a syntax error. The ?> grouping modifier is a single element in the regex syntax, and must stay together. This is true for all such constructs, including lookaround, named groups, etc.
- FrizzleFry
- Platinum Member
- Posts: 1241
- Joined: 2005 Oct 16, 19:09
Keep in mind that something like:
[1-35]
is valid, it matches 1,2,3,5
It is the 3-1 range that is invalid.
[1-35]
is valid, it matches 1,2,3,5
It is the 3-1 range that is invalid.
Last edited by FrizzleFry on 2012 Jan 31, 19:56, edited 1 time in total.
It is? I thought it was a character-class range problem (as in single-characters) - which is why the solution of "[3-9]|1[0-5]" (or "[0-9]{1,2}" for double-digits) was the correct conclusion? (RegEx makes my head hurt every time I think about playing with it.)FrizzleFry wrote:Keep in mind that something like [1-35] is valid (1,2,3,5) - It is the 3-1 range that is invalid.