How to remove from file name all characters that are out from a set

Hi all.

I need help about Regular Expression. I've already read the FAQ and other topics about this argument without resolve my problem.

My target is remove from the file name all characters that are different from letters, numbers and some others characters. I really made many attempts without find the solution before open this thread.

Can someone help me?

Thanks in advance.

Action type: Replace with regular expression
Field: _FILENAME
Regular expression: [^A-Za-z0-9 '.]
Replace matches with:
[ ] case-sensitive comparison

This preserves all letters, digits and spaces, plus the chracters ' (single quote) and . (period). The "hat" (^) means any character not included inside the brackets, so what you're doing is listing all the characters that you want to keep. Just add any additional characters that you like. Note that some special characters (like the period shown in the expression above) require escaping - that is, precede the character with a backslash (). Those special characters are . | * ? + ( ) { } [ ] ^ $.

Start with this ...

Action: Format value
Field: _FILENAME
Formatstring: $regexp(%_filename%,'[^\w]',)

From:
24#96 Vinyl Rip - aksman 2011 - 1999 Speakers Corner SP-3647 - DG 2513725
To:
2496VinylRipaksman20111999SpeakersCornerSP3647DG2513725

... then add 'some other characters' into the negated set (square brackets) to exclude them from removing.

Action: Format value
Field: _FILENAME
Formatstring: $regexp(%_filename%,'[^\w-]',)

From:
24#96 Vinyl Rip - aksman 2011 - 1999 Speakers Corner SP-3647 - DG 2513725
To:
2496VinylRip-aksman2011-1999SpeakersCornerSP-3647-DG2513725

FYI:
\w represents the character class [[:word:]]
\W represents the character class [^[:word:]]

DD.20111230.1748.CET

It was very simple. Evidently, i'm not so intelligent. :huh:

Many thanks, people, and Happy New Year. :slight_smile: