Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8305733

Pattern.CASE_INSENSITIVE does not take effect in jdk11

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      System:
      Ubuntu 22.04.2 LTS on Windows 10 x86_64

      Java Runtime Information:
      openjdk version "11.0.12" 2021-07-20
      OpenJDK Runtime Environment 18.9 (build 11.0.12+7)
      OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      Pattern.CASE_INSENSITIVE does not take effect in jdk11, but it can match characters normally when using jdk17

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run included source code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Pattern.compile("some\\p{javaLowerCase}*Name", Pattern.CASE_INSENSITIVE) can match the value of "someOtherName"

      ---------- BEGIN SOURCE ----------
      import java.util.ArrayList;
      import java.util.regex.Matcher;
      import java.util.regex.Pattern;

      public class BugReport {
          public static void main(String[] args) {
              Pattern normalisedCamelCasePattern = Pattern.compile("some\\p{javaLowerCase}*Name", Pattern.CASE_INSENSITIVE);
              ArrayList<String> candidates = new ArrayList<>();
              candidates.add("someName");
              candidates.add("someOtherName");
              for (String candidate : candidates) {
                  Matcher matcher = normalisedCamelCasePattern.matcher(candidate);
                  if (matcher.lookingAt()) {
                      System.out.println("success:" + candidate);
                  } else {
                      System.out.println("fail:" + candidate);
                  }
              }
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : rarely


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: