[Cialug] Regular Expression Search & Replace Problem

Todd Walton tdwalton at gmail.com
Mon Jan 8 22:43:04 UTC 2018


On Thu, Jan 4, 2018 at 12:35 PM, Zachary Kotlarek <zach at kotlarek.com> wrote:

> You can’t do that in a line-by-line regex. You might be able to do it
> taking the whole set of lines into a single regex, but it wouldn’t be
> pretty.
>

Well, here's ugly!

search: ^(\S+)\s+(\S+\h\S+)\s+(\S+\h\S+)\s+(\S+\h\S+)(?=\n\n)
replace: \1 \2\n\1 \3\n\1 \4

I'd like to make it work no matter how many indented lines there are below
the initial non-indented line. I haven't figured that out.

--
Todd


More information about the Cialug mailing list