Regular languages are closed under intersection (as well as difference,
complement, and of course union).
I find myself needing to know whether two regexps intersect. That is,
whether the intersection of the two regexps is not empty.
I could code it up using the algorithm which can be found just about
anywhere regular language theory is sold, e.g.
But I wonder if there’s a better way to do this using ruby regular
expression tricks, or at least a way that is already coded up for me?