Don't use regex!. You only need a plain-text match to replace "
"
.
Use replace()
to replace a literal string with another:
string = string.replace("
", " --linebreak-- ");
Note that replace()
still replaces all occurrences, as does replaceAll()
- the difference is that replaceAll()
uses regex to search.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…