9
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 13 Jul 2023
9 points (90.9% liked)
Linux
48376 readers
1587 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
I'm not familiar with the TRegExpr engine and its quirks, so I could be wrong about some or all of this, but let's try anyway:
The characters in the brackets describe a set of characters, but without any quantifier after the brackets, they will only match a single character. If you want to match an entire string, you should begin the regex with a ^ character (which means "start of string" when outside brackets), have a quantifier such as * or + after the list and then end it with $ ("end of string").
The ^ character reverses the list, so it will match any characters not in the list. This may be what you want (i.e. to copy all the files that matches because they do not contain the characters in the list), but I feel that it should be mentioned.
I suspect that you may need to escape the / character with a . And since the error message mentions * and ? I'd also try escaping those.
So to match only the filenames that are FAT32 safe, I'd try something like this:
^[^\\\/:\*\?\"<>|]+$
https://regex101.com/ is a great site for learning regex so I'd recommend that you try it out there (and keep in mind that different regex engines can have subtle differences, but sadly the site doesn't do TRegExpr).