1
输入
:
content
=
"<!DOCTYPE html>↵<html>↵<head>↵</head>↵<body>↵
\n
<p>原文</p>↵</body>↵</html>"
.
replace
(
/
(
↵
)
+
|
(
\n
)
+
|
(
\r\n
)
+
/
g
,
""
)
2
输入:
content =
"<!DOCTYPE html>↵<html>↵<head>↵</head>↵<body>↵
\n
<p>原文</p>↵</body>↵</html>".
replace(
/
(
↵
)
+
/
g,
"")
得到:
"<!DOCTYPE html><html><head></head><body><p>原文</p></body></html>"