function deleteFields($tag, $pcre = null)
    {
        $cnt = 0;
        foreach ($this->getFields() as $field) {
            if (($pcre
                && preg_match("/$tag/", $field->getTag()))
                || (!$pcre
                && $tag == $field->getTag())
            ) {
                $field->delete();
                $cnt++;
            }
        }
        return $cnt;
    }
function deleteFields($tag, $pcre = null)
    {
        $cnt = 0;
        foreach ($this->getFields() as $field) {
            if (($pcre
                && preg_match("/$tag/", $field->getTag()))
                || (!$pcre
                && $tag == $field->getTag())
            ) {
                $field->delete();
                $cnt++;
            }
        }
        return $cnt;
    }
function deleteFields ( $ tag , $ pcre = null ) { $ cnt = 0 ; foreach ( $ this -> getFields ( ) as $ field ) { if ( ( $ pcre && preg_match ( "/$tag/" , $ field -> getTag ( ) ) ) || ( ! $ pcre && $ tag == $ field -> getTag ( ) ) ) { $ field -> delete ( ) ; $ cnt ++ ; } } return $ cnt ; }
Delete all occurrences of a field matching a tag name from the record.

@param string $tag  tag for the fields to be deleted
@param bool   $pcre if true, then match as a regular expression

@return int         number of fields that were deleted
Delete all occurrences of a field matching a tag name from the record .