Instead of using $(match) scope, return captures from matching function

This change makes a few CFEngine function implementations to use
matches returned directly from the StringMatchCaptures instead of
relying on side-effects of FullTextMatch.
Fix escape() testsuite

Previous tests were broken due to way regmatch() matched strings.