#1 2025-04-15 02:46

visusys
Member
Registered: 2021-10-16
Posts: 22

Replace Rule: Ability to specify unicode ranges in wildcard brackets?

I have the following "Find" entry in a replace rule:

[a-z0-9]&[a-z0-9]

, and the "Replace" entry is

$1 & $2

. This effectively pads ampersands with spaces when they occur immediately after and before an alphanumeric character.

Example:

Equinoxe Brass&Strings-00-Equinoxe Brass&Strings-037-Equinoxe Brass&Strings C#1-C#1.wav

Becomes:

Equinoxe Brass & Strings-00-Equinoxe Brass & Strings-037-Equinoxe Brass & Strings C#1-C#1.wav

But I want to expand the wildcard character class to include all valid windows characters, which can consist of any Unicode character except for a few illegal characters.

For reference, the illegal characters are:

<  >  :  "  /  \  |  ?  *

.

How can I modify my find character class from [a-z0-9] to include all valid Unicode characters? I want the rule to also be compatible with filenames that contain unicode characters and not just alphanumeric characters.

Is this possible?

Offline

#2 2025-04-15 21:25

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,479

Re: Replace Rule: Ability to specify unicode ranges in wildcard brackets?

Why don't you use word boundary or word character classes?

Expression: "\b&\b"
Replace: " & "

Expression: "(\w)&(\w)"
Replace: "$1 & $2"

These will work just fine with Unicode text.

Offline

Board footer

Powered by FluxBB