fix regex rules and add comments