Escape special characters outside matching groups