in reply to Removing unwanted chars from filename.
I would strongly recommend Corion's Text::CleanFragment.
As for your regex, note that [:ascii:] is defined as "Any character in the ASCII character set", and the string you've shown here is entirely ASCII, so your code is "working". Perhaps you meant s/[^[:alnum:]]//g or e.g. s/[^[:alnum:]._-]//g instead? (Update: and though tr/A-Za-z0-9._-//cd should be faster, the above module handles Unicode well, so that's why I'd still recommend that)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Removing unwanted chars from filename.
by kcott (Archbishop) on Oct 06, 2022 at 22:40 UTC | |
by haukex (Archbishop) on Oct 07, 2022 at 06:02 UTC | |
by kcott (Archbishop) on Oct 07, 2022 at 06:29 UTC |
In Section
Seekers of Perl Wisdom