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

Pattern.compile("\\") throws internal error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.4.1_01, 1.4.2
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      When trying to call String.replaceAll("\\", "X") to replace all '\'s with 'X's, the following error has been raised:
       
      Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
       ^
      at java.util.regex.Pattern.error(Pattern.java:1472)
      at java.util.regex.Pattern.compile(Pattern.java:1264)
      at java.util.regex.Pattern.<init>(Pattern.java:1013)
      at java.util.regex.Pattern.compile(Pattern.java:760)
      at java.lang.String.replaceAll(String.java:1706)
      at RA.main(RA.java:5)

      ###@###.### 2002-11-24

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: