This is an excerpt from Manning's book SQL Server MVP Deep Dives Vol. 2. Login to get full access to this book.
Figure 3. A regular expression collapsed the first four lines (query shown on top) into a single line (query shown on bottom).