fixing regex patterns and changing EXTERNAL origin to bottom left
(internal array has its origin at top left though)