Use start and end of string rather than line matching in regexes.

@arthurnn & @fw42 for review

## Problem

Liquid uses the bad practice of using line anchors rather than start and end of string anchors.

## Solution

Use string anchors as long as the regex didn't actually expect matches in the middle of a multi-line string.