Replace characters in filename playlist creation

Hi
I'm trying to write an action that trawls through all my mp3s in all folders and creates a playlist in each folder

The code below works fine:

$filename(%_folderpath%\$if($eql(%albumartist%,Various Artists),$cutleft(%album%,6),%artist% - $cutleft(%album%,6)).m3u8,utf-8)#EXTM3U
#EXTART:$if($eql(%albumartist%,Various Artists),%albumartist%,%artist%)
#EXTALB:%album%
$loop(%track%)$loop(%_filename_ext%)#EXTINF:%_length_seconds%,%artist% - %title%
%_filename_ext%
$loopend()$loopend()

However - if I have artists or albums with with / or : in them I want to replace them with -
The code below does not work and does not even create a playlist. I have tried wrapping the $replace function around $filename function and within it - neither works

$filename($replace(%_folderpath%\$if($eql(%albumartist%,Various Artists),$cutleft(%album%,6),%artist% - $cutleft(%album%,6)),/,-,:, - ).m3u8,utf-8)#EXTM3U
#EXTART:$if($eql(%albumartist%,Various Artists),%albumartist%,%artist%)
#EXTALB:%album%
$loop(%track%)$loop(%_filename_ext%)#EXTINF:%_length_seconds%,%artist% - %title%
%_filename_ext%
$loopend()$loopend()

Any ideas
Thanks
G

For example ... here is the underline character used instead of the hyphen minus character ...

$filename(%_folderpath%$replace($if($eql(%ALBUMARTIST%,'Various Artists'),$cutLeft(%ALBUM%,6),%ARTIST%'/:* - '$cutLeft(%ALBUM%,6))'.m3u8','/','_',':','_','*','_'),utf-8)

... or ...

$filename(%_folderpath%$replace($if($eql(%ALBUMARTIST%,'Various Artists'),$cutLeft(%ALBUM%,6),%ARTIST%'/:* - '$cutLeft(%ALBUM%,6)),'/','_',':','_','*','_')'.m3u8',utf-8)

... or ...

$filename(%_folderpath%$regexp($if($eql(%ALBUMARTIST%,'Various Artists'),$cutLeft(%ALBUM%,6),%ARTIST%'/:* - '$cutLeft(%ALBUM%,6)),'[/:*]','_')'.m3u8',utf-8)

Example for a MTE script ...

01: $filename(%_folderpath%$regexp($if($eql(%ALBUMARTIST%,'Various Artists'),$cutLeft(%ALBUM%,6),%ARTIST%' - '$cutLeft(%ALBUM%,6)),'[/:*]','_')'.m3u8',utf-8)$puts(

02: )'#EXTM3U'
03: '#EXTDATE - original creation date of the playlist'
04: '#EXTAUTHOR - playlist author'
05: '#EXTCOVER - name and location of an image file with the CD cover art'
06: '#EXTBACK - same as #EXTCOVER, but backside'
07: '#EXTINLET - same as #EXTCOVER, but inlet, maybe multiple'
08: '#EXTIMAGE - generic associated image, maybe multiple'
09: $loop(%TRACK%)$loop(%_filename_ext%)
10: '#EXTARTIST '%ARTIST%
11: '#EXTALBUM '%ALBUM%
12: '#EXTTITLE '%TITLE%
13: '#EXTNUMBER '%TRACK%
14: '#EXTINF '%_length_seconds%','%ARTIST%' - '%TITLE%
15: %_filename_ext%
16: $loopend()$loopend()

DD.20140505.1835.CEST