this post was submitted on 13 Jul 2023
8 points (90.0% liked)

Linux

48181 readers
1232 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

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hi all,

I've been breaking my head on this for the past while and I figured I'd ask the hive mind here.

I'm using Double Commander as my file browser of choice, and I'm copying some files to an SD card that goes into an mp3 player running Rockbox, which only accepts FAT32 file systems.

I've tried to get all the filenames as compatible with FAT32 as possible, but here and there there's still some file names that contain symbols incompatible with FAT32 ( , \ , / , : , * , ? , " , < , > , | .)

Now, Double Commander allows to use file templates for copying files, which includes the option for a file mask using regex. I figured I ought to be able to use this to skip files using these characters. Looking at regex syntax and googling for something similar to have already been done (I found this Stackexchange question) I came up with this regular expression:

[^\\/:*?\"<>|]

Double commander then spits out the following error, though:

Unhandled exception: ERegExpr: TRegExpr compile: quantifier ?+*{ follows nothing (pos 1)

Any ideas on what I'm doing wrong? Regex is kind of foreign to me, so I'm guessing I'm doing something fundamentally wrong that should be easy to solve for someone who knows what they're doing.

you are viewing a single comment's thread
view the rest of the comments
[–] nyan@lemmy.cafe 2 points 1 year ago* (last edited 1 year ago) (1 children)

Nearly all of the characters you're trying to skim out are regex metacharacters. Most of them shouldn't have any effect inside a character class, but it's possible that the implementation you're dealing with is substandard. The "escape everything possibly meaningful" version looks like ^[^\\\/\:\*\?\"<>\|]+$ (MummifiedClient5000 missed the |, which is a regex "or" operator).

If you're not given to labelling your files in non-ASCII character sets, you can always go in the reverse direction and list the characters that are permitted, something like ^[a-zA-Z0-9\. -_~&%]+$ (add a few more punctuation marks at the end if you need 'em).

The other possibility, which I'm hoping is not the case, is that your regex filter is expecting POSIX regular expressions rather than the normal Perl-compatible, in which case you've got some more reading to do. (I doubt it, though.)

[–] toothpaste_sandwich@feddit.nl 1 points 1 year ago

Thanks so much!

I tried out your regex suggestions and they resulted in the same error. I was just about to file a bug report when I realised that I had not only filled in the regex in the field for a File mask, but also some filetypes in another field called Exclude files... Doublecmd with both fields filled in

As soon as I removed the contents of "Exclude files", the error went away. Makes sense, I suppose. Now I'm off to figure out how to exclude files with regex as well.