in reply to multiline regex

You can use the /m or /s modifiers on your regex to match newlines. See perlre for more details. (Search for 'newline' and it'll put you right there.)

The former makes the ^ and $ anchors match any new line in your string, and the latter makes . match newlines. Subtly different, but very useful.