So, using a content manager allowing humans to enter lch values https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch, I want to have a regular expression to limit the values they can enter.
I do not need to match the lch( nor the ending ) I just need to match the values passed as a parameter in the lch() - so from the MDN article above example values might be
29.2345% 44.2 27
52.2345% 72.2 56.2
I think to make the expression easier I will have the opacity written as a different field.
Each line above is an example parameter passed to the lch function.
From the MDN article mentioned above
functional notation for the parameters: L C H [/ A]
Where L is a percentage from 0% to 100%, as can be seen from the examples above the percentages allow decimal percentages - I think up to 4 spaces after the decimal point is reasonable.
The second argument C is the chroma (roughly representing the "amount of color"). Its minimum useful value is 0, while its maximum is theoretically unbounded (but in practice does not exceed 230). Again percentages allowed.
The third argument H is the hue angle. 0deg points along the positive "a" axis (toward purplish red), 90deg points along the positive "b" axis (toward mustard yellow), 180deg points along the negative "a" axis (toward greenish cyan), and 270deg points along the negative "b" axis (toward sky blue). Again we can see percentages are allowed in the third argument.
I don't necessarily need it to be perfect I would be fine with a regex that allowed all the characters allowed in an LCH value.
I believe the regex variation used is JavaScript.