in reply to multi line matching problem

One more way $text = join ' ', split ' ', $text; uses magical split. The is one difference in the result; magical split will remove leading and trailing whitespace, instead of replacing it with a single space.

After Compline,
Zaxo