Implementation for line_match and contents_match rules

Includes test cases and documentation.