Regex issue (MultinameSearch)

General discussion related to "Everything".
Post Reply
Debugger
Posts: 630
Joined: Thu Jan 26, 2017 11:56 am

Regex issue (MultinameSearch)

Post by Debugger »

^(?!.*(filename1|filename2|filename300)$).*ArtistName.*\.mp3$

Entering a long regex can be cumbersome, especially when I have many file names to search. Is there any way to manage this process more efficiently?
And tell me what should be added to my regex so that it searches only in folders that contains at least the word e.g. "X:\172....." this works perfectly in MasterSeeker because I can enter "172" in "In Directory"
void
Developer
Posts: 16698
Joined: Fri Oct 16, 2009 11:31 pm

Re: Regex issue (MultinameSearch)

Post by void »

The $ in your regex search will not match anything.



Create the following bookmark:
Name: Insert multiline regex
Change the Search to: /replace-sel <REGEXREPLACE:clipboard:,"\n","|">

Set your search to:
regex:"^(?!.*()).*ArtistName.*\.mp3$"
Place your caret inside the ()
Select your filenames from a multiline text file.
Open your bookmark from above.


And tell me what should be added to my regex so that it searches only in folders that contains at least the word e.g. "X:\172....."
X:\172 regex:^(?!.*(filename1|filename2|filename300)).*ArtistName.*\.mp3$
-or-
path:172 regex:^(?!.*(filename1|filename2|filename300)).*ArtistName.*\.mp3$
Debugger
Posts: 630
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue (MultinameSearch)

Post by Debugger »

If I have to perform operations in Everything (which I do not fully understand) then I already prefer to simple paste the text (as regex) in MasterSeeker so it is faster. What you have provided is certainly a valuable tutorial, but rather not for me such fun every time ((too many steps)).
horst.epp
Posts: 1444
Joined: Fri Apr 04, 2014 3:24 pm

Re: Regex issue (MultinameSearch)

Post by horst.epp »

Debugger wrote: Tue Apr 23, 2024 1:24 pm If I have to perform operations in Everything (which I do not fully understand) then I already prefer to simple paste the text (as regex) in MasterSeeker so it is faster. What you have provided is certainly a valuable tutorial, but rather not for me such fun every time ((too many steps)).
It doesn't help to always compare things with Master Seeker,
which by the way can't beat Everything in functionality.

If you need some complicated search often, store it in a bookmark and/or filter.
Searching in indexed data by regex is always fast here.
Debugger
Posts: 630
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue (MultinameSearch)

Post by Debugger »

But a super-fast search doesn't involve many steps, you just need to instantly combine the names in one or 2 steps, and then within seconds have the results in MasterSeeker, without having to add yet another command (typing) in Everything.
As simple as possible.

Script python:
import re

Code: Select all

import re

# Ścieżka do pliku z nazwami piosenek
file_path = 'nazwy_piosenek.txt'

# Otwórz plik i wczytaj nazwy piosenek
with open(file_path, 'r', encoding='utf-8') as file:
    file_names = [line.strip() for line in file if line.strip()]

# Połącz nazwy piosenek w regex
regex_pattern = "|".join(re.escape(name) for name in file_names)

# Utwórz finalne wyrażenie regularne
final_regex = f"^(?!.*({regex_pattern})$).*[b] ANY NAME ARTIST.[/b]*\.mp3$"

print(final_regex)

Step 1: Prepare the file names_songs.txt
Create a text file names_songs.txt and put all the song names in it, each on a new line:
XXXX

Step 2: Run the Python script
Run the following Python script in the folder where the file names_songs.txt is located:
XXXXX


Result
After running the above script, it will display the final regular expression that you can use to search for the corresponding files:
XXXX

But it's still a lot of steps with the script, don't want to play around in the text editor every time to create the necessary regex with names+one artist
Post Reply