Escaped whitespace and slashes in Heregexes

* Resolves #3059: Don't remove escaped whitespace.
* Fixes #2238: Prevent escaping slashes that are already escaped.
* Fix detection of end of heregex with escaped slashes.
Merge pull request #3214 from marchaefner/issue3059

Escaped whitespace and slashes in Heregexes
Escapable linebreaks in heregexes
Missing parentheses
Merge pull request #3218 from marchaefner/issue3059

Escapable linebreaks in heregexes