Hi jlassell,
From looking at your starting text:
Starting text:
----------------
<Expression>ajjb ;aeif j;; =
jot aldi addoao
flda- ee=10200 </Expression>
I see a discrepancy with your ending text...
You say it should look like this:
<Expression>ajjb ;aeif j;; = jot aldi addo aoflda-ee=10200 /Expression>
but I assume you meant this:
<Expression>ajjb ;aeif j;; = jot aldi addoao flda- ee=10200 </Expression>
It looks like what you want is to remove the EOL (newline) from the end of all lines that do NOT end with "</Expression>"
There is no way to exactly specify that in TextPad but this is close:
First, select from the menu to use "POSIX regular expression syntax":
Configure -> Preferences -> Editor
[X] Use POSIX regular expression syntax
Then choose Search-Replace ... (<F8> key):
Find what: ([^>]|[^n][>]|[^o]n>|[^i]on>|[^s]ion>|[^s]sion>|[^e]ssion>|[^r]ession>|[^p]ression>|[^x]pression>|[^E]xpression>|[^/]Expression>|[^<]/Expression>)\n
Replace with: \1
[X] Regular expression
[Replace All]
If you need to add a space between the joined lines then:
Find what: ([^>]|[^n][>]|[^o]n>|[^i]on>|[^s]ion>|[^s]sion>|[^e]ssion>|[^r]ession>|[^p]ression>|[^x]pression>|[^E]xpression>|[^/]Expression>|[^<]/Expression>)\n
Replace with: \1_ Replace underscore with a space
[X] Regular expression
[Replace All]
You need to make sure that you select all the "blue" text from the "From what:" line. If it is split onto multiple lines, you need to cut and paste it together. It does NOT contain any spaces.
Here is that line again, in a "code" block:
Code: Select all
([^>]|[^n][>]|[^o]n>|[^i]on>|[^s]ion>|[^s]sion>|[^e]ssion>|[^r]ession>|[^p]ression>|[^x]pression>|[^E]xpression>|[^/]Expression>|[^<]/Expression>)\n
This search-replace will actually remove newlines from the end of any line that is NOT an exact match to any right-hand substring of "</Expression>"
So, lines like these will NOT join with the next line
Lines like these WILL join with the next line
Code: Select all
abc ession>
anythingssion>
5 ression>
If this is not acceptable, then you could perform the steps below just one time. If you like, you can record it as a macro. This will combine all sets of 2 or more lines:
First you need find a character that is NOT found anywhere in your file, or at least is not found as the last character of any line.
For this example, I used the "¤" character. You could probably use any "High-order-8-bit-character" like (Ø ¿ « » º ° ¬ § ¤ or £ ¢ €)
First, search for all lines ending in "</Expression>" and add that character ("¤") to the end like: "</Expression>¤"
Select from the menu to use "POSIX regular expression syntax":
Configure -> Preferences -> Editor
[X] Use POSIX regular expression syntax
Then choose Search-Replace ... (<F8> key):
Find what: (</Expression>)$
Replace with: \1¤
[X] Regular expression
[Replace All]
Then, remove the newline from the end of all lines that do NOT end with "¤":
Search-Replace ... (<F8> key):
Find what: ([^¤])\n
Replace with: \1
[X] Regular expression
[Replace All]
If you need to add a space between the joined lines then:
Find what: ([^¤])\n
Replace with: \1_ Replace underscore with a space
[X] Regular expression
[Replace All]
At this point you have all lines joined, (with a space if needed). Lastly, we need to remove the "¤" from the end of all the "</Expression>¤" lines:
Search-Replace ... (<F8> key):
Find what: (</Expression>)[¤]$
Replace with: \1
[X] Regular expression
[Replace All]
I hope this helps...
Kevin