I recently came across the branch specifier in Vim regex builtins. Vim\'s help section on \\&
contains this:
A branch is one or more concats
\&
can be used to match a line containing two (or more) words in any order. For example,
/.*one\&.*two\&.*three
will find lines containing one
, two
and three
in any order. The .*
is necessary because each branch must start matching in the same place.
Note, the last branch is the one that participates in any substitution. For example, applying the following substitution:
s/.*one\&.*two\&.*three/<&>/
on the line
The numbers three, two, and one
results in