Fix incorrect scope issue

The regtext had some extra new lines, which were throwing the regex that confirms scope off.

Also adjusted to account for subparts when looking for definitions. This wouldn't have caused a bug, but may make debugging other issues easier.