Page 1 of 1

delete blank lines

Posted: Sun Aug 09, 2009 10:54 pm
by ulopez
which regular expression I can use to eliminate blank lines before and after a text?

Posted: Mon Aug 10, 2009 8:33 am
by DV
To delete blank lines in TextCrawler use the following regular expression-
^\r?\n?$
and replace with nothing.

Try it in the regex test first if you are not sure.


Posted: Mon Aug 10, 2009 2:55 pm
by ubiet
thanks
but, if for example I has the following text:

"end if

Posted: Mon Aug 10, 2009 3:03 pm
by ubiet
thanks
but, if I only need eliminate the blank lines that are before or after a specific text. how can I do it.


Posted: Fri Aug 14, 2009 8:05 pm
by DV
Deleting after a specific text is something like-

regex: foo[\r\n]*
replace: foo\r\n

Posted: Thu Sep 16, 2010 1:19 am
by John
Hello! Thanks for this wonderful app! My question: how can i remove more than two empty lines?

Example:

abc
abc


abc
abc

to turn to

abc
abc

abc
abc

Thanks in advance :)

Posted: Thu Sep 16, 2010 8:36 pm
by Fool4UAnyway
Try something like:
^((\r\n?|\n))(\r\n?|\n)+$

Replace with:
$1

Posted: Fri Sep 17, 2010 3:51 pm
by John
thanks fool4uanyway. I tried ^\r\n^\r\n and it worked fine :D

Posted: Fri Sep 17, 2010 8:38 pm
by Fool4UAnyway
If you rerun the replacement, or just scan after the first pass, does it still find matches?