我正在尝试使用以下代码行验证PHP中的GUID。
$case_number = "088169ed-7a9d-4f78-b999-170971247642\n";
$GUID_validation_RegEx = '/^[A-Fa-f\d]{8}-[A-Fa-f\d]{4}-[A-Fa-f\d]{4}-[A-Fa-f\d]{4}-[A-Fa-f\d]{12}$/';
print(preg_match($GUID_validation_RegEx, $case_number));
它返回1 (true)
我已将问题缩小到以下范围...
^[A-Fa-f\d]{8}-[A-Fa-f\d]{4}-[A-Fa-f\d]{4}-[A-Fa-f\d]{4}-[A-Fa-f\d]{12}$
^^^ these A-F (if I remove them the new line does not match)
为什么会这样,我该如何解决?