So a note on “practicality” here…
Recently I had cause to implement some “OR” searches as described above.
I pulled up this thread for the “formula”, put my specific use-case data in, and pressed Find All in Current Document, and, well, …, waited, a loooong time for results to come back.
It turns out that the regexes specified above are fine for “small” data, but are rather inefficient for “bigger” data, or at least the size/type of data I had.
Here’s an example:
The original “match entire line OR regex” above is (?-s)(?:(?=.*Bob|.*Ted))^.*(?:\R|\z)
For my data, that one took between one and two minutes to run.
If I change the regex to (?-s)^(?=.*?(?:Bob|Ted)).+, that one runs so quickly that it is hard to time, except to say maybe it takes a second or so.
Probably all of the regexes I presented in my table above could be better optimized. :-(