attempts to fix trailing \r
Added line ending to Regex
Add provision for more sophisticated patterns (multi-layer)