Author Topic: Regular expression: easier "find empty lines"  (Read 652 times)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Regular expression: easier "find empty lines"
« on: January 20, 2009, 03:06:10 pm »
The RegEx ^$ find empty lines.

But to replace them by nothing (to delete empty lines)
you have to search for line enders too: ^$\r\n

Other editor delete empty lines just simply by
Find: ^$
Replace:

I guess they add those EOL char at there own, without user access???
Maybe you want to do the same. Just if you once rewrite your regex engine, please think about this behavior.
Stefan, HippoEDIT beta tester  (HippoEDIT News On Twitter: http://twitter.com/hippoedit/)

Online alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Regular expression: easier "find empty lines"
« Reply #1 on: January 22, 2009, 01:47:20 pm »
Hello Stefan,

I think reason for such "non-standard" behavior, is same as problems with greedy search - I am trying to emulate text stream from array of single lines.

So probably when I would fix problem with greedy search, this would also gone. But I would check any way, and if it is easy would implment it with current logic (if this would no require big changes).

Thanks for suggestion ;)

Online alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Regular expression: easier "find empty lines"
« Reply #2 on: January 22, 2009, 01:58:20 pm »
Hi once more,

which other editors you mean? I have tested several (EditPlus, Notepad++) but none of them works as you have described, but does it like hippoedit (mostly).

So now I am not sure, that this is a good solution... Because it is not standard and can be a surprise for user :)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 774
  • Karma: +6/-0
    • View Profile
Re: Regular expression: easier "find empty lines"
« Reply #3 on: January 22, 2009, 03:40:27 pm »
  :o  right now all editors i test didn't support this.  ::)
Perhaps this was an dream only, because it is logically ?

Only VIMs :g/^$/ d and SEDs "/^$/d" (and perhaps PERL) do that.

So i was wrong, sorry.

 

Related Topics

  Subject / Started by Replies Last post
5 Replies
752 Views
Last post February 15, 2009, 04:28:32 pm
by alex
6 Replies
1024 Views
Last post November 02, 2009, 11:12:18 pm
by alex
15 Replies
1573 Views
Last post May 05, 2010, 08:03:04 pm
by alex
5 Replies
278 Views
Last post July 17, 2011, 12:43:28 am
by alex
6 Replies
350 Views
Last post August 24, 2011, 05:08:07 pm
by false007