Closed rabestro closed 3 years ago
https://github.com/hyperskill/hs-test/blob/5437461540644124acf234ca875667a8c4e5af7c/src/main/java/org/hyperskill/hstest/common/Utils.java#L43
String::replaceAll uses regular expression engine. In any cases where we need to replace regular string it is better to use String::replace.
.replaceAll("\r\n", "\n").replaceAll("\r", "\n") equals to .replaceAll("\r\n?", "\n")
.replaceAll("\r\n", "\n").replaceAll("\r", "\n")
.replaceAll("\r\n?", "\n")
@rabestro Thanks! Then it's better to just use replace because we have the same line in Python library.
replace
Fixed in https://github.com/hyperskill/hs-test/commit/c31b45447bb6cebfae7607479fd4c5e157fe04d0
https://github.com/hyperskill/hs-test/blob/5437461540644124acf234ca875667a8c4e5af7c/src/main/java/org/hyperskill/hstest/common/Utils.java#L43
String::replaceAll uses regular expression engine. In any cases where we need to replace regular string it is better to use String::replace.
.replaceAll("\r\n", "\n").replaceAll("\r", "\n")
equals to.replaceAll("\r\n?", "\n")