Ich brauche Stringfollow bekommen dieses Format (C-001 und C-001-C)Fehler Verwendung PHP preg_match nicht Zeichenfolge übereinstimmen
C-001 (match)
C-002C (not match)
C-003-C (match)
D-004 (not match)
Dies ist mein Code
if(preg_match("/^C-[0-9]$/", $input_line, $output_array)) {
print_r($output_array);
} else {
echo "NOT MATCH";
}
Aber Ergebnis 3 anzeigen Schnur (C-001, C-002C, C-003-C), C-002C ist falsch, wie man es repariert?