Remove Blank Line/Rows

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
mikebecker
Posts: 2
Joined: Thu Aug 14, 2008 1:07 pm

Remove Blank Line/Rows

Post by mikebecker »

For example, I have the text below and want to remove the blank lines:


Logout |


Pending Approval

Supply Chain Approval Step

Request Number idM AR_0089124

Requester Data
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Search for: \n\n
Replace with: \n

Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Hope this was helpful.............good luck,
Bob
mikebecker
Posts: 2
Joined: Thu Aug 14, 2008 1:07 pm

Post by mikebecker »

Awesome. That worked great.
adavies42
Posts: 1
Joined: Wed Nov 19, 2008 3:03 am

Post by adavies42 »

Bob Hansen wrote:Search for: \n\n
Replace with: \n
any reason \n+ doesn't work? this is the only regex engine i've ever seen that considers that "invalid"
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Can't tell you why, but the TextPad version of RegEx does not support multiple lines unless they are explicitly entered, ie: \n\n\n

So, to handle multiple lines it works to replace "\n" with something else that may not show up. I use the tilde "~".
Make the changes that are needed.
Then go back and replace "~" with "\n"
Hope this was helpful.............good luck,
Bob
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Bob Hansen wrote:Can't tell you why, but the TextPad version of RegEx does not support multiple lines unless they are explicitly entered, ie: \n\n\n
My guess is:

Textpad splits the given Regex at the \n.
It then applies the first part to a line.
If it matches, it applies the second part against the next line.
If it matches, it applies the third part to the next line.
And so on.

This would explain why quantifiers can't be applied to \n, why \n can't appear between \n, and why backreferences don't work across lines.
nvj1662
Posts: 53
Joined: Thu May 17, 2007 10:02 am

Post by nvj1662 »

Bob Hansen wrote:Can't tell you why, but the TextPad version of RegEx does not support multiple lines unless they are explicitly entered, ie: \n\n\n
I'm sure there's a good reason, but why doesn't Texpad use another RegEx then?
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

MudGuard's guess is a good explanation of how it is currently working.

But he and I are just an end users like yourself. You will need to have someone from Helios explain why they made that choice years ago, and why they have not changed it. All we can do right now is work with it as best we can.
Hope this was helpful.............good luck,
Bob
nvj1662
Posts: 53
Joined: Thu May 17, 2007 10:02 am

Post by nvj1662 »

Thanks for the info Bob. Sorry, but as you are such a frequent & helpful poster, I had assumed that you worked for Helios :oops:
Post Reply