I need to do the same thing but have it apply to an entire expression that I already have. So, to be specific, I have this the custom expression field [iTunesFileKey] which is:
M:\iTunes_cache\[Handheld Audio Path]\if(regex([Filename (name)],/#\.(mp3|mp4|m4a|m4v|m4p|m4b|m4r|jpg)$#/),[Filename (name)],Filename(,0).mp3)
[Handheld Audio Path] is, itself an expression:
Audio\If(IsEmpty([Media Sub Type]),Music,[Media Sub Type])\If(IsEmpty([Artist]),Unknown,[Artist])\If(IsEmpty([Album]),Unknown,[Album])If(IsEmpty([Disc #],1),,\[Disc #])
I need to check that whole thing for invalid filename characters and have them converted to _ as MC will do when it syncs the handheld. But, obviously, I need the colon after M to stay as it is. I've also noticed that MC seems to be converting ampersand characters to & in my expression, but these come through in the actual filename as ampersands. (On second thought, this might just be the logging in MCiS that is doing that.)
A "Filename Friendly" mode for Clean() would be so much simpler, and would be fantastic. But, barring that, can anyone help? I'm hopelessly lost as to how this would apply to my need.