Forum Moderators: open

Message Too Old, No Replies

Searching for special characters in Windows 11

         

csdude55

6:33 pm on Aug 4, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For as long as I can remember, when I download something from my server via FTP I've changed the original to include a + at the end so that I'll have a safe backup. So I end up having a list of files like:

example++++.php
example+++.php
example++.php
example+.php
example.com

This is all fine and dandy until it's time to clean up the old files that I don't need anymore. I only recently learned that Windows 11 has basic regex in the Windows Explorer search, so searching for a + returns pretty much everything instead of files with a literal plus sign in the name.

Using the obvious \+ returned nothing, though.

Google's coming up empty for me on this one, too.

Do any of you know how to search for a file name with a literal + in the file name, in Windows 11?

ronin

6:40 pm on Aug 4, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just a speculative guess, but does:

[\+]


work any better than:

\+


?

lucy24

7:29 pm on Aug 4, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just a speculative guess, but does:
[\+]
work any better
While you're at it, try plain
[+]
since the + sign has no special meaning in grouping brackets. Unless, of course, Windows 11 has invented its own flavor of RegEx. (Wouldn't put it past 'em. For comparison purposes, it was a hideous shock to learn that in BBEdit, the ampersand & has a special meaning in replace patterns. 8,000 guesses how I learned this.)

Edit: It's also worth trying the double-escape \\+

csdude55

8:46 pm on Aug 4, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sadly...

[+] returned everything
[\+] returned nothing
\\+ returned nothing

And for the sake of trying everything, \\\+ also returned nothing :-(


8,000 guesses how I learned this.)

Probably the same way that I learned DELETE * FROM table WHERE foo='bar' isn't the same as DELETE FROM table WHERE foo='bar'... :-O

csdude55

7:28 pm on Aug 5, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Still can't find a solution, so how about an alternative...

I use Notepad++ for coding. And if you use Ctrl + Shift + F you can search for all files in a directory that contain FOO, and apply filters to restrict the search to specific filenames.

Under "Filters" I usually use:

*.php *.css *.js

to restrict it to PHP, CSS, and JS extensions.

Any thoughts on how to also say and the filename doesn't contain a +?

I've tried several variations like this with no luck, and I'm not sure that it's possible:

(*.php *.css *.js) && !\+
(*.php *.css *.js) && !*\+.*

Since I don't have to escape the . then it's obviously not a regex, anyway, just a series of wildcards that are pre-defined. But I can't find that predefined list anywhere.

I found a thread in their forum about it as a feature request, but that was in 2015 and I couldn't find anything more updated.

I also downloaded Total Commander in the hopes that it would be able to do a search and exclude the +, but no dice.

phranque

10:20 pm on Aug 5, 2022 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



this would be trivial using unix commands.

instead of "regular expressions" or "wildcards", do some research on "file globbing" and perhaps you will find a sufficient windows solution.

tangor

6:47 am on Aug 6, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



EDIT:

Never mind ... realize this was about Win11!

This works in Win7 *+.*

csdude55

6:35 am on Aug 7, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, @phranque... that took me down the rabbit hole :-O

Best I can tell, the only way to accomplish this is using PowerShell:

Get-ChildItem -Recurse | Where {$_.Name -match '+'} | Select Fullname

[shellgeek.com...]

My end goal was to move them to some other directory, or maybe even delete them, so I'm not sure that this query is going to actually help me. And I'm never going to remember that ridiculously complex format in the future, anyway. But it answers the question, so maybe it'll help some future googler :-)