original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Delete all occurrences of a field matching a tag name from the record .