-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove empty lines #74
Comments
Hi @demisx, this is a regex question, try posting it on Stack Overflow and you're sure to get some answers! |
If you do find you're unable to get it to work after trying other strategies, please re-open the issue. |
Hi. Thank you for the quick response. I know that |
@demisx Interesting, I will investigate it. |
@demisx that matches the whitespace itself, but it doesn't match the newline. Did you try |
No, I don't believe I've tried this one yet. And it did work. Sorry for the false alarm -- I need to refresh my memory on regex matches. Stupid me. Totally forgot that |
@demisx it happens to the best of us, I'm glad you solved it! In the mean time, I am adding a test for this because it IS possible there could be weirdness between a buffered and streamed replace involving a newline, and I want to make sure it's working. Thanks! |
@lazd You are awesome man! I wish I could give you more than one star. |
@demisx so apparently That said, the results are inconsistent between streams and buffers! This regex does not work when input is buffered, so this is still an issue! |
@demisx I pushed some tests to the |
tried it and it works. replace(/(?:(?:\r\n|\r|\n)\s){2}/gm, '\r\n') |
Correct me if I'm wrong but the Sept 21st 2016 comment contains If you want to check in regexr, try:
@dashawk snippet is better, it uses "or" but it only removes more than 2 consecutive empty lines. I'm not sure that's exactly what was asked — cases of more than 1 consecutive empty line should be replaced with a single line break. What if we simply replaced instances of:
with |
Is it possible to remove empty lines in files using
gulp-replace
? I've tried this, but it didn't work:Thanks.
The text was updated successfully, but these errors were encountered: