I have a script taking mythtv recorded shows and encoding them in h264 using handbrake. the script is written in Perl.
My questions is how do I replace spaces and special characters with and underscore using perl?
The strings look something like this when output "Parks and Recreation - S05E01 - Ms. Knope Goes to Washington"
I would like it to look like this
Parks_and_Recreation_S05E01_Ms__Knope_Goes_to_Washington
Thanks in advance. I did do some googling but having found anything useful that I can implement.
Something like this might do it – notice that you might introduce duplicates if you transform strings like this.
This outputs:
Edit
Érics comment below is very relevant, here is a slightly better approach that replaces accented characters with unaccented before making substitutions:
This variant outputs: