/
52.html
152254.html
152255.html
152256.html
152257.html
8172396.html
8177822.html
8180348.html
仅有的幸福2017-05-18 10:55:03
function delAmpty(str) {
return str.replace(/\s/g,'');
}
alert(delAmpty('hello world'));
This roughly means s matches the whitespace character, and replace is ok. Try it yourself
Be sure to add /g when replacing everything!
迷茫2017-05-18 10:55:03
My guess is to replace two newlines with one newline, also taking into account whether the blank lines contain spaces.
The above string is equivalent to:
a = '\\n\n52.html\n152254.html\n152255.html\n152256.html\n152257.html\n\n8172396.html\n8177822.html\n8180348.html';
I don’t know python, it’s implemented in JavaScript:
str.replace(/\n\s*\n/g,'\n');