- Issue created by @kensae
- Status changed to Needs review
7 months ago 10:40am 24 April 2024
The regular expression in the validateFormElement doesn't seem to validate for correct rgb / rgba values.
I've reviewed the regular expression for HEX, rbg, rgba, hsl and hsla values and this one seems to work:
preg_match("/(?(DEFINE)(?<rgb>[0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))(?(DEFINE)(?<del>\,{1}\s?))(?(DEFINE)(?<hue>[0-9]|[1-9][0-9]|[1-2][0-9][0-9]|[3][0-5][0-9]|[3][6][0]))(?(DEFINE)(?<percent>[0-9]|[1-9][0-9]|[1][0][0]))(?(DEFINE)(?<alpha>0?\.[0-9]{1,2}))^\#((((\d|[a-f]){3}){1,2})|((\d|[a-f]){8}))$|^rgba\(\g'rgb'\g'del'\g'rgb'\g'del'\g'rgb'\g'del'\g'alpha'\)$|^rgb\(\g'rgb'\g'del'\g'rgb'\g'del'\g'rgb'\)$|^hsl\(\g'hue'\g'del'\g'percent'\%\g'del'\g'percent'\%\)$|^hsla\(\g'hue'\g'del'\g'percent'\%\g'del'\g'percent'\%\g'del'\g'alpha'\)$/", $value, $matches);
Needs review
1.0
Code