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

incorrect Pattern.CANON_EQ handling

    XMLWordPrintable

Details

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows & Linux

      A DESCRIPTION OF THE PROBLEM :
      Exception in thread "main" java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 31

      REGRESSION : Last worked in version 11.0.15

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      java Main

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Console output: "Result: true"
      ACTUAL -
      Exception in thread "main" java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 31
      ^\s*(ИП|Индивидуальны(?:и?)|й)|и)?)\b.*$
                                     ^
              at java.util.regex.Pattern.error(Pattern.java:1969)
              at java.util.regex.Pattern.compile(Pattern.java:1706)
              at java.util.regex.Pattern.<init>(Pattern.java:1352)
              at java.util.regex.Pattern.compile(Pattern.java:1054)
              at Main.main(Main.java:7)

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

      class Main
      {
          public static void main(String args[])
          {
      Pattern p = Pattern.compile("^\\s*(ИП|Индивидуальный)\\b.*$", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.CANON_EQ);
      System.out.println("Result: " + p.matcher("Индивидуальный предприниматель").matches());
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      It will work, if I remove Pattern.CANON_EQ flag

      FREQUENCY : always


      Attachments

        Activity

          People

            igraves Ian Graves
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: