Fixed regular expressions (also changed them to the simplified form) and added some comments on their purpose.