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

Linebreak matcher is not equivalent to the pattern as stated in javadoc

XMLWordPrintable

    • b161
    • generic
    • generic
    • Verified

        A DESCRIPTION OF THE PROBLEM :
        The documentation for Linebreak Matcher \R states that it is equivalent to a specific pattern. However if we substitute that equivalent pattern into a regex, it can give different results.
        See the following Stack Overflow question and answer for details--
        http://stackoverflow.com/q/42474596/7098259

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        ...is equivalent to (?<!\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029])
        ACTUAL -
        ...is equivalent to \u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]

        URL OF FAULTY DOCUMENTATION :
        https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html

              sherman Xueming Shen
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: