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

Pattern matcher works for Java 11 and 17 but not 21.

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      import static org.junit.Assert.assertEquals;

      import java.util.regex.Pattern;

      import org.junit.Test;

      public class PatternTest
      {
          @Test
          public void testDEstring()
          {
              String input = "Östl. Umgehungsstraße";
              String expected = "Östliche Umgehungsstraße";
              
              Pattern rule = Pattern.compile("(?i)\\bÖstl\\. Umgehungsstraße\\b");
              
              String output = rule.matcher(input).replaceAll("Östliche Umgehungsstraße");
              
              // Works for Java 11 and 17
              // Fails with OpenJDK21U-jdk_x64_windows_hotspot_21.0.7_6
              assertEquals("message", expected, output);
          }
      }





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

              Created:
              Updated: