System.out.println("du hast mich".replaceAll("(?<=^(.*)) ", ", $1 "));
// prints "du, du hast, du hast mich"
What does the symbol mean ^after it looks? (I know that the standard value of this symbol is the beginning of a line), and why the dot symbol matches what it was then, and then, yes, that is. Why does the dot character not match the entire string?
Please give me an explanation of how this regular expression works correctly. I wonder. Thank you for your interest.
source
share