Hello, could someone please help me with a couple related searches I'm trying to accomplish?
I have many mp3 files on my computer whose filenames over the years I have put a bunch of g's in a row in, in order to indicate that these mp3s
have me playing guitar in them. I want to organize the files so they only have 20 g's in a row in them from now on. But currently they have somewhere between 10 and 27 g's in a row in them.
Here's the searches I'd like to accomplish:
all files with exactly 20 g's in a row in their filenames, for example:
2201108_abc123ggggggggggggggggggggabc123.mp3
all files with ten or more g's in a row in their filenames, but not filenames with exactly 20 g's in a row in their filenames, for example:
search result would show filenames like these:
2201108_abc123ggggggggggabc123.mp3 (10 g's in a row)
2201108_abc123gggggggggggggggabc123.mp3 (15 g's in a row)
2201108_abc123gggggggggggggggggggggggggggabc123.mp3 (27 g's in a row)
but would not show filenames like these:
2201108_abc123ggggggggggggggggggggabc123.mp3 (20 g's in a row)
2201108_xyz98_gggggggggggggggggggg_yz987.mp3 (20 g's in a row)
Maybe some usage of Search> Match Whole Word?
I don't know how to use regular expressions yet, but maybe some formula with those would do it?
Thanks for any help with this.
;;;;;;;;;;;
Edit:
Also, a search that would show, for example, all files with only exactly 3 g's in a row in the filenames, like these:
2201108_abc123gggabc123.mp3 (only exactly 3 g's in a row)
xyz321_ggg.mp3 (only exactly 3 g's in a row)
thus not these
2201108_abc123gggggggggggggggggggggabc123.mp3 (more than 3 g's in a row)
xyz321_ggggggggg.mp3 (more than 3 g's in a row)
;;;;;;;;;;;
How to find only certain ranges of individual letters in a row in filenames? etc
Re: How to find only certain ranges of individual letters in a row in filenames? etc
Make sure that Regular Expressions under Search is unchecked.
search for mp3 files with g in the names:
where n - min count of g in the file name
m - max count of g in file name
- find mp3 files with 3 or more g's in the file name
- find mp3 files with 3 to 7 g's in the file name
- find mp3 files with exactly 20 g's in filename.
search for mp3 files with g in the names:
Code: Select all
regex:(?<!g)g{n,m}(?!g) ext:mp3
m - max count of g in file name
Code: Select all
regex:(?<!g)g{3,}(?!g) ext:mp3
Code: Select all
regex:(?<!g)g{3,7}(?!g) ext:mp3
Code: Select all
regex:(?<!g)g{20}(?!g) ext:mp3
Re: How to find only certain ranges of individual letters in a row in filenames? etc
Thanks so much for your help with this.
I am trying out your searches, so far so good.
I'm also trying to figure out how the regular expressions work.
I know it will take some time, but seems to be a powerful searching method, especially within Everything.
Wow, so somehow that regular expressions you gave factors in the g's being in a row too it seems. (which is what I wanted)
I mean, if I use your:
regex:(?<!g)g{20}(?!g) ext:mp3
this will return, for example:
200113_001gggggggggggggggggggg.mp3
but this will not return:
200113_001ggggggggggcatmeowgggggggggg.mp3
both filenames having 20 g's, but the second's filename g's are not in a row.
Awesome, thanks!
I am trying out your searches, so far so good.
I'm also trying to figure out how the regular expressions work.
I know it will take some time, but seems to be a powerful searching method, especially within Everything.
Wow, so somehow that regular expressions you gave factors in the g's being in a row too it seems. (which is what I wanted)
I mean, if I use your:
regex:(?<!g)g{20}(?!g) ext:mp3
this will return, for example:
200113_001gggggggggggggggggggg.mp3
but this will not return:
200113_001ggggggggggcatmeowgggggggggg.mp3
both filenames having 20 g's, but the second's filename g's are not in a row.
Awesome, thanks!
Re: How to find only certain ranges of individual letters in a row in filenames? etc
Indeed these regexs finds g's only in a sequence
Try https://regex101.com/ and https://www.regular-expressions.info for learning regex
Try https://regex101.com/ and https://www.regular-expressions.info for learning regex
Re: How to find only certain ranges of individual letters in a row in filenames? etc
Everything can even help renaming the files to the structure you want:
Not tested, but the following might work as well as the searchquery?
It uses the following regular expression features from menu:Help => Regex syntax (marked in bold font):
If that information helps you understand what the regex above does, you made a huge step forward in understanding regex.
(at least: when it actually turn out to be working ...)
- In the Everything search bar, type or paste the search query provided by @ovg (nice one, btw!)
- Select all files ('CTRL + A')
- Press F2 (or menu:File => Rename) to rename these files
- In the rename dialog, tick the Regular expressions box
- Enter the following search/replace pattern:
Code: Select all
Old format:g{10,} New format:ggggggggggggggggggg
- Check the results in the New Filemnames box
- If all is OK, press the OK button
- Done.
Not tested, but the following might work as well as the searchquery?
Code: Select all
ext:mp3 regex:[^g]g{10,27}[^g]
If that information helps you understand what the regex above does, you made a huge step forward in understanding regex.
(at least: when it actually turn out to be working ...)
a|b Matches a or b
gr(a|e)y Matches gray or grey
. Matches any single character
[abc] Matches a single character a, b or c
[^abc] Matches any single character except a, b or c
[a-z] Matches a single character in the range a to z
[a-zA-Z] Matches a single character in the range a to z or A to Z
^ Matches the start of the filename
$ Matches the end of the filename
( ) Defines a marked subexpression
\n Matches what the nth marked subexpression matched, where n is a digit from 1 to 9
\b Match word boundaries
* Matches the preceding element zero or more times
? Matches the preceding element zero or one times
+ Matches the preceding element one or more times
*? Lazily matches the preceding element zero or more times
+? Lazily matches the preceding element one or more times
{x} Matches the preceding element x times
{x,} Matches the preceding element x or more times
{x,y} Matches the preceding element between x and y times
\ Escape special character
Re: How to find only certain ranges of individual letters in a row in filenames? etc
Thanks for the links ovg.
NotNull, thank you for the ideas you presented. I look into these things and will reply back.
Thanks again to you both for your help with this! Much appreciated.
NotNull, thank you for the ideas you presented. I look into these things and will reply back.
Thanks again to you both for your help with this! Much appreciated.