Page 1 of 1
Remove Blank Line/Rows
Posted: Thu Aug 14, 2008 1:18 pm
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
Posted: Thu Aug 14, 2008 6:35 pm
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
-----------------------------------------
Posted: Thu Aug 14, 2008 8:14 pm
by mikebecker
Awesome. That worked great.
Posted: Wed Nov 19, 2008 3:06 am
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"
Posted: Wed Nov 19, 2008 4:27 am
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"
Posted: Mon Nov 24, 2008 7:35 am
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.
Posted: Mon Nov 24, 2008 8:46 am
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?
Posted: Mon Nov 24, 2008 2:40 pm
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.
Posted: Wed Nov 26, 2008 8:46 am
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
