Pass test for maintain_escape_character. Fix some bugs(rewrite regex patterns).