0 Members and 1 Guest are viewing this topic.
regexpreplace('^(/|\|:|*|?|"|>|<||) \d+',getplayerstat(ID,'name'),' ',true);
regexpreplace('[^\w]',getplayerstat(ID,'name'),'_',true); //replacing all but numalpha with underscore
regexpreplace('[/\///|/?/</>]',getplayerstat(ID,'name'),'_',true); //replacing \/|?<> with underscore
Haven't tested the examples. I know Toumaz has a working function to change a string in a file name. It's in a private script though, so you'd have to ask him.
// For Windows compability; filter a filename from invalid symbols.// Yes, modifying this to use RegExpReplace would be awesome.function FilterFilename(const filename: string):string;var i,len: byte; c: string;begin len:=length(filename); result:=''; for i := 1 to len do begin c := copy(filename,i,1); if (c=chr(92))or(c='/')or(c=':')or(c='*')or(c='?')or(c='"')or(c='<')or(c='>')or(c='|') then result:=result+'_' else result:=result+c; end; result:=LowerCase(result);end;