Fix regular expression matching bug + clean up, test, and document

string_utils