0

I'm trying to validate a GUID in PHP with the following line.

$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));

It returns 1 (true)

I've narrowed down the problem to the following ...

^[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)

Why is this happening and how can I fix it?

Akustik
  • 43
  • 8

0 Answers0