keeps track of heads/tails; regex for rule