I am new to java regex.I saw this in Docs:
$ The end of a line
But when I try this snippet:
String str = "firstline\r\nsecondline";
String regex = "$";
System.out.println(str.replaceAll(regex, "*"));
I guess result will be:
firstline*
secondline*
But I see this result:
firstline
secondline*
It seems that it $
only matches the end of a String. So why do the docs say it matches "The end of a line"?