How do I verify the following strings?

The

string can only be swapped for . , /: , cannot contain other characters, you only need to verify whether the string contains only the above four characters.

$string = "10.0.3.1, 10.0.0.0/16,2001:db8:100:934b::3:1, 2001:db8:100:934b::/64";
if (checkString($string)) {
    return true;
} else {
    return false;
}

function checkString(string $string) {
// 
}

// 
if (preg_match("/^(\.|\,|\/|\:)+$/", $string)) {
    var_dump("yes");
} else {
    var_dump("no");//no
}

// 
if (preg_match("/^[a-zA-Z0-9.\/:, ]+$/", $string)) {
    var_dump("yes");
} else {
    var_dump("no");
}

is not empty / ^ [., /:] + $/
can be empty / ^ [., /:] * $/
are you asking the wrong question? A string contains only'., /: 'what's the meaning of checking


regular
^ [., /:] + $


/ ^ (\. |\, |\ / |\: | [A-Za-z0-9] |\ s) + $/ like this?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34b93-2bf3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34b93-2bf3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?