06.01.2019, 11:02
How can i check for invalid hex code color in a dialog with ShowPlayerDialog if player insert an invalid hex code color in a dialog to get a message like this ''invalid hex color'' but how to check for this ?
sscanf x will fail on them.
Or if you want to scan a whole string you could use a very complex regex: \{[^}]*[^a-fA-F0-9}].*?\}|\{[a-fA-F0-9]{0,5}\}|\{[a-fA-F0-9]{7,}\}|^[^{]*\}|\{[^}]*$ Which will check for any {} with a non-hex character between them, or 0-5 hex characters, or 7+ hex characters, or an unopened brace, or an unclosed brace. |
/^#[0-9A-F]{6}$/i