Notes:
If the UUID is valid, you get it back.
If the UUID is invalid, you get an empty string back.

Pass 1 in mode to not require braces around UUID. Pass 2 to ignore minus characters. Pass 3 to combine those two.
You can add 4 to have the GUID fixed a bit like adding braces and minus chars if missing.
The requiredVersion parameter can be 1 to 5 to indicate the required GUID version you want to have.