On Tue, 14 Feb 2023 16:12:29 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:
> Split off from https://github.com/openjdk/jfx/pull/837 > > This uses a precompiled regex pattern and cleans up the code in > WebColorFieldSkin a bit. modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/WebColorFieldSkin.java line 42: > 40: private static final String HEX_DIGIT = "[A-Fa-f0-9]"; > 41: private static final Pattern PATTERN = Pattern.compile("#?" + > HEX_DIGIT + "{6}"); > 42: private static final Pattern PARTIAL_PATTERN = Pattern.compile("#?" + > HEX_DIGIT + "{0,6}"); You might also use the character class `\p{XDigit}`, which matches a hexadecimal character. ------------- PR: https://git.openjdk.org/jfx/pull/1032