Outside the box

Today it turned out that looking at things from a different angle can solve all your problems. In terms of a regular expression problem I tried to solve, it was helpful to start thinking at the end of the previous line instead of the start of a line.