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

REGRESSION: java.util.regex.Pattern Multiline $: matches everywhere

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.1
    • core-libs



      Name: rmT116609 Date: 07/09/2002


      FULL PRODUCT VERSION :
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Windows Millennium [Version 4.90.3000], Solaris2.8.

      A DESCRIPTION OF THE PROBLEM :
      java.util.regex.Pattern:
      in Multiline-Mode the Boundary matcher "$" matches almost everywhere in the input.

      REGRESSION. Last worked in version 1.4

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

      public class PatternTest {
      public static void main(String[] args) {
      Pattern pattern = Pattern.compile("$", Pattern.MULTILINE);
      System.out.println(pattern.matcher("Hello World").replaceAll("x"));
      }
      }
      ---------- END SOURCE ----------

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Actual Result: xHxexlxlxox xWxoxrldx
      Expected: Hello World
             or

      Hello Worldx

      REPRODUCIBILITY :
      This bug can be reproduced always.

      Release Regression From : 1.4
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 158747)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: