Spaces and Periods in file names

General discussion related to "Everything".
Post Reply
fredjones
Posts: 4
Joined: Wed Dec 21, 2022 6:39 pm

Spaces and Periods in file names

Post by fredjones »

A lot of my files use periods/dots (".") in lieu of a space so that Linux is happy. I would like to be able to search for files where everything treated spaces and periods as equivalent but w/o having to use some fancy formula. For example, in Chrome I have a bookmark called "everything" that searches for files with the name of the highlighted text. The highlighted text often contains spaces but a file on the hard drive may contain periods instead of spaces.

Example: Highlighted text = "abc def ghi" and file on disk is "abc.def.ghi". I would like to be able to search for either one and have both show up.

Note: The Bookmark was downloaded from here and I would give credit where due but I dont remember which post it was from:

"javascript:location.href='es:'+document.getSelection();void(0);"

Best bookmark ever!
NotNull
Posts: 5261
Joined: Wed May 24, 2017 9:22 pm

Re: Spaces and Periods in file names

Post by NotNull »

Updated version of your bookmarklet:

Code: Select all

javascript:location.href='es:'+document.getSelection().toString().replace(/[\!\#\$\-\{\}\(\)\[\]\)\.\,\_]/g,'%20');void(0)
This replaces special characters like .!#_-, etc from the selected text you you will search for "abc def ghi", which will find "abc_def.ghi" too.


See also this thread for a couple of alternatives.
fredjones
Posts: 4
Joined: Wed Dec 21, 2022 6:39 pm

Re: Spaces and Periods in file names

Post by fredjones »

Cool! Thanks!
Post Reply