parsing and matching lines