regular expression

File name sanitizer

This is a way to sanitize a string to be used as file name or URL path etc. by removing unwanted characters or replacing them with a hyphen or similar.
It takes a string like:
Daily SimpliVity Backup 12/16/2018 02:00:215
and converts it into:

Remove empty places in comma separated list with preg_replace

This is how you can remove empty places in a comma separated list e.g when you have a list like "one, , two, , three, , " and you want it to look like "one, two, three"

= "one, , , two, ";
//$input = ", two, two, ";
    //$input = ", two, two";
$input = preg_replace( "/, , |, $|^, /", "", $input);