RFR: 8037397: RegEx pattern matching loses character class after intersection (&&) operator [v2]

YassinHajaj github.com+18174180+yassinhajaj at openjdk.java.net
Sun Apr 25 09:26:36 UTC 2021


On Fri, 2 Apr 2021 15:44:23 GMT, Ian Graves <igraves at openjdk.org> wrote:

>> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixing missing space
>
> Tagging with CSR because this will impact a long-standing (buggy) behavior.

Hi @igraves ,

If you want to test all characters from `A-Z` and `0-9`, consider using `rangeClosed` instead of `range`


Stream<Character> letterChars = IntStream.range('A', 'Z').mapToObj((i) -> (char) i);
Stream<Character> digitChars = IntStream.range('0', '9').mapToObj((i) -> (char) i);

Becomes

Stream<Character> letterChars = IntStream.rangeClosed('A', 'Z').mapToObj((i) -> (char) i);
Stream<Character> digitChars = IntStream.rangeClosed('0', '9').mapToObj((i) -> (char) i);

-------------

PR: https://git.openjdk.java.net/jdk/pull/3291


More information about the core-libs-dev mailing list