Please consider this sample:
header-1
item1-1
item1-2
item1-3
header-2
item2-1
item2-2
...
and I want it in this format:
header-1 item1-1
header-1 item1-2
header-1 item1-3
header-2 item2-1
header-2 item2-2
...
I guess there is easy way to do this with regex, but I just can’t figure out
Any regex syntax is welcomed, I use RegexBuddy under Wine
With RegexBuddy, you can do it in two steps.
First search for
(?<=(^\S.*$)(?s:.*?))^\s+and replace all with\1<space>.This gives you
Explanation:
Then search for
^(.*)$\r?\n(?=\1)and replace with the empty string.This results in
Explanation: