java.lang.IllegalArgumentException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • FULL PRODUCT VERSION : java version "1.8.0_73" Java(TM) SE Runtime Environment (build 1.8.0_73-b02) Java HotSpot(TM) Client VM (build 25.73-b02, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Windows 10 EXTRA RELEVANT SYSTEM CONFIGURATION : In Matcher.java line 854 is written: // The first number is always a group refNum = (int)nextChar - '0'; if ((refNum < 0)||(refNum > 9)) throw new IllegalArgumentException( "Illegal group reference"); That the first character after $ is always a number is not correct. A DESCRIPTION OF THE PROBLEM : That the first character after $ is always a number is not correct. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : public static void main(String[] args) { final String k = "1234"; System.out.println(k.replaceAll("23", "$&")); } ACTUAL - Exception in thread "main" java.lang.IllegalArgumentException: Illegal group reference at java.util.regex.Matcher.appendReplacement(Matcher.java:857) at java.util.regex.Matcher.replaceAll(Matcher.java:955) at java.lang.String.replaceAll(String.java:2210) at overlay.StartupTest.main(StartupTest.java:52) ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "main" java.lang.IllegalArgumentException: Illegal group reference at java.util.regex.Matcher.appendReplacement(Matcher.java:857) at java.util.regex.Matcher.replaceAll(Matcher.java:955) at java.lang.String.replaceAll(String.java:2210) at overlay.StartupTest.main(StartupTest.java:52) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public static void main(String[] args) { final String k = "1234"; System.out.println(k.replaceAll("23", "$&")); } ---------- END SOURCE ----------
    via by Webbug Group,
  • Java regex match with error due to $
    via Stack Overflow by DarthVader
    ,
    • java.lang.IllegalArgumentException: Illegal group reference at java.util.regex.Matcher.appendReplacement(Matcher.java:857) at java.util.regex.Matcher.replaceAll(Matcher.java:955) at java.lang.String.replaceAll(String.java:2210) at overlay.StartupTest.main(StartupTest.java:52)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    AxeloAxelo
    5 times, last one,
    treanztreanz
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    15 more bugmates