Hello, @dochbert, @ekopalypse, @terry-r, @Coises, @mark-olson and All,
Mark, from your INPUT text :
|Date|Percentage|
|:-|:-|
|February 9|0.30769230769231%|
|February 10|0.30864197530864%|
|February 11|19%|
|February 14|0.3125%|
|February 15|0.31347962382445%|
|February 16|0.31446540880503%|
|February 17|0.31545741324921%|
|February 18|5%|
|February 22||
|Blerun 33|15.7934343%|
|rkejrkej 22||
|rjerkjekre 33333|78.334343%|
|rekerkekre |99.4444%|
|jgkjgkf||
|yiowpwk||
If we delete the two last lines |jgkjgkf|| and |yiowpwk||, then, after running your search-replacement, I got this text:
|Date|Percentage|
|:-|:-|
|February 9||
|February 10|0.30769230769231%|
|February 11|0.30864197530864%|
|February 14|19%|
|February 15|0.3125%|
|February 16|0.31347962382445%|
|February 17|0.31446540880503%|
|February 18|0.31545741324921%|
|February 22|5%|
|Blerun 33||
|rkejrkej 22|15.7934343%|
|rjerkjekre 33333||
|rekerkekre |78.334343%99.4444%|
Note that the last line is not exact and should be |rekerkekre |78.334343%| only
Thus, I tried to solve this problem and here is a generalization of your method !
Let’s suppose we have this text :
|Year|Month|Day|Percentage|
|:-|:-|:-|:-|
|2025|February|10|0.1%|
|2025|February|11|0.2%|
|2025|February|12||
|2025|February|13|0.4%|
|2025|February|14|0.5%|
|2025|February|15||
|2025|February|16||
|2025|February|17|0.6%|
|2025|February|18|0.7%|
|2025|February|19|0.8%|
And that we want to move all text of the column 4 downwards
Note that the last line |2025|February|19|0.8%| is followed with a line-break which ends the file contents !
First, with this first regex S/R, we replace any | character, except for the first one and the last two containing the percentage value, by a ! char
FIND (?!^)\|(?=.+\|.*?\|$)
REPLACE !
So our INPUT text is changed as :
|Year!Month!Day|Percentage|
|:-!:-!:-|:-|
|2025!February!10|0.1%|
|2025!February!11|0.2%|
|2025!February!12||
|2025!February!13|0.4%|
|2025!February!14|0.5%|
|2025!February!15||
|2025!February!16||
|2025!February!17|0.6%|
|2025!February!18|0.7%|
|2025!February!19|0.8%|
Now, we apply the main regex S/R :
FIND (?-s)(\d+(?:\.\d+)?%)?(\|\R\|.*?\|)|(?:[^%\r\n]+%(?=\|\R\z))
REPLACE ${2}${1}
Running that S/R once, we get :
|Year!Month!Day|Percentage|
|:-!:-!:-|:-|
|2025!February!10||
|2025!February!11|0.1%|
|2025!February!12|0.2%|
|2025!February!13||
|2025!February!14|0.4%|
|2025!February!15|0.5%|
|2025!February!16||
|2025!February!17||
|2025!February!18|0.6%|
|2025!February!19|0.7%|
Then, if desired, you may again re-run this regex S/R and it returns :
|Year!Month!Day|Percentage|
|:-!:-!:-|:-|
|2025!February!10||
|2025!February!11||
|2025!February!12|0.1%|
|2025!February!13|0.2%|
|2025!February!14||
|2025!February!15|0.4%|
|2025!February!16|0.5%|
|2025!February!17||
|2025!February!18||
|2025!February!19|0.6%|
And… after some clicks on the Replace All button, you should get :
|Year!Month!Day|Percentage|
|:-!:-!:-|:-|
|2025!February!10||
|2025!February!11||
|2025!February!12||
|2025!February!13||
|2025!February!14||
|2025!February!15||
|2025!February!16||
|2025!February!17||
|2025!February!18||
|2025!February!19||
Finally, the trivial S/R
FIND !
REPLACE |
Would replace all the ! chars by the separator character
Best Regards,
guy038