The ^
is a special character in Java regex - it means "match the beginning" of an input.
You will need to escape it with "\^"
. The double slash is needed to escape the
, otherwise Java's compiler will think you're attempting to use a special ^
sequence in a string, similar to
for newlines.
^
is not a special escape sequence though, so you will get compiler errors.
In short, use "\^"
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…