completed check_anchor_tag method