Added tests and fixed escaping anchors error

^ and $ anchor tags were being escaped by re.escape within
random_substring as it was being fed each string in ^string$ form. Now,
the strings are fed in raw, and anchor tags added on after escaping the
substring