hex code color
#2

Quote:
Originally Posted by Y_Less
View Post
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.
Wouldn't this suffice?

Code:
/^#[0-9A-F]{6}$/i
Reply


Messages In This Thread
hex code color - by Cezar98 - 06.01.2019, 11:02
Re: hex code color - by GRiMMREAPER - 06.01.2019, 12:02
Re: hex code color - by Cezar98 - 06.01.2019, 12:43

Forum Jump:


Users browsing this thread: 1 Guest(s)