Remove unwanted characters

@param string $field Field to be filtered
189617
protected static function filter($field)
    {
        $field = preg_replace('/[\.\/\\:;,?$*!#_-]/', '', $field);
        $field = preg_replace('/\s+/', ' ', trim($field));
        return $field;
    }
964382
public static function camelCaseToSnakeCase(string $field): string
    {
        return strtolower(preg_replace(self::REGEX_CAPITAL, self::REPLACEMENT_UNDERSCORE, $field));
    }
1312813
private static function scrubAttributes($field, $type = null)
    {
        $invalid_keys = [
            'default',
            'description',
            'label',
            'options',
        ];

        if ($type && $type ==='textarea') {
            $invalid_keys[] = 'value';
        }

        foreach ($invalid_keys as $invalid_key) {
            if (array_key_exists($invalid_key, $field)) {
                unset($field[$invalid_key]);
            }
        }
        return $field;
    }
632167
protected function parseFieldName($field, $table = false){
		// preg_replace callback behaviour
		if(is_array($field))
			$field = $field[0];
		if($field instanceof Literal)
			return $field->value;

		$field = trim($field);

		if($field === '*')
			return $field;

		if(strpos($field, ' '))
			return $field;

		$field = str_replace(':', '', $field);

		if(strpos($field, '.') !== false || $table === true){
			$prefix = $this->stmt->getConnection()->getPrefix();
			$field = $prefix . $field;
		}

		return $this->stmt->getConnection()->getDriver()->escape($field, Manager::IDENTIFIER);
	}
424062
public static function cleanString($texto = '')
    {
        $texto = trim($texto);
        $aFind = ['&', 'á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ú', 'ü', 'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ú', 'Ü', 'Ç'];
        $aSubs = ['e', 'a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'u', 'u',
            'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'U', 'U', 'C', ];
        $novoTexto = str_replace($aFind, $aSubs, $texto);
        $novoTexto = preg_replace("/[^a-zA-Z0-9 @,-.;:\/]/", '', $novoTexto);

        return $novoTexto;
    }
286699
public function getQualifiedFieldName($field)
	{
		$tbl = ($this->getTableAlias() ? $this->getTableAlias() : $this->getTableName());
		return $tbl . '.' . $field;
	}
519001
public function remove($field)
    {
        if (! is_array($field)) {
            $field = func_get_args();
        }

        foreach ($field as $f) {
            $this->update('$unset', $f, 1);
        }

        return $this;
    }
596913
public static function cleanFields($fields)
    {
        $fields = parent::cleanFields($fields);

        //If config is requested add id and type as they are need to pull config.
        if (in_array('config', $fields)) {
            $fields[] = 'id';
            $fields[] = 'type';
        }

        //Removing config from field list as it is not a real column in the table.
        if (in_array('config', $fields)) {
            $key = array_keys($fields, 'config');
            unset($fields[$key[0]]);
        }

        return $fields;
    }
1360261
private function parseField(string $field): array
    {
        $source = static::DEFAULT_SOURCE;
        $type = static::DEFAULT_TYPE;
        $origin = null;

        if (strpos($field, '(') !== false) {
            $source = substr($field, strpos($field, '(') + 1, -1);
            $field = substr($field, 0, strpos($field, '('));

            if (strpos($source, ':') !== false) {
                list($source, $origin) = explode(':', $source);
            }
        }

        if (strpos($field, ':') !== false) {
            list($field, $type) = explode(':', $field);
        }

        return [$field, $type, $source, $origin];
    }
1136611
public function isString($field)
    {
        $def = strtolower($this->getFieldDefinition($field));
        if (strpos($def, 'varchar') !== false) {
            return true;
        }
        if (strpos($def, 'text') !== false) {
            return true;
        }
        return false;
    }
897254
public function withoutHeader(string $field): self {
        $lower = \strtolower($field);

        $clone = clone $this;

        unset(
            $clone->headerCaseMap[$lower],
            $clone->headers[$lower]
        );

        return $clone;
    }
1203064
protected function normalize($field)
    {
        $normal = array(
            'type' => 'string',
            'field' => array('text'),
            'valid' => array(),
            'label' => '',
            'holder' => '',
            'search' => false,
            'required' => false
        );

        if(isset($field['type'])) {
            $normal['type'] = $field['type'];
        }

        if(isset($field['label'])) {
            $normal['label'] = $field['label'];
        }

        if(isset($field['holder'])) {
            $normal['holder'] = $field['holder'];
        }

        if(isset($field['search'])) {
            $normal['search'] = !!$field['search'];
        }

        if(isset($field['field'])) {
            if($field['field'] === false
                || is_array($field['field'])
            ) {
                $normal['field'] = $field['field'];
            } else if(is_string($field['field'])) {
                $normal['field'][0] = $field['field'];
            }
        }

        if(isset($field['valid'])) {
            if(is_array($field['valid'])) {
                $normal['valid'] = $field['valid'];
            } else if(is_string($field['valid'])) {
                $normal['valid'][] = array($field['valid']);
            }

            foreach($normal['valid'] as $i => $validation) {
                if(!is_array($validation)) {
                    $validation = array($validation);
                }

                $normal['valid'][$i] = $validation;

                if($validation[0] === 'required') {
                    $normal['required'] = true;
                }
            }
        }

        if(isset($field['default'])) {
            $normal['default'] = $field['default'];

            if(is_null($normal['default'])) {
                $normal['default'] = 'null';
            } else if($normal['type'] === 'int'
                && !$this('validation', $normal['default'])->isType('int', true)
            ) {
                $normal['default'] = '0';
                $normal['valid'][] = array('int');
            } else if($normal['type'] === 'float'
                && !$this('validation', $normal['default'])->isType('float', true)
            ) {
                $normal['default'] = '0.00';
                $normal['valid'][] = array('float');
            } else if($normal['type'] === 'boolean'
                && !$this('validation', $normal['default'])->isType('bool', true)
            ) {
                $normal['default'] = '0';
                $normal['valid'][] = array('bool');
            } else if($normal['type'] === 'datetime'
                && ($normal['default'] === 'now'
                || $normal['default'] === 'now()')
            ) {
                $normal['default'] = 'CURRENT_TIMESTAMP';
                $normal['valid'][] = array('datetime');
            } else if($normal['type'] === 'date') {
                $normal['valid'][] = array('date');
            } else if($normal['type'] === 'time') {
                $normal['valid'][] = array('time');
            } else if(is_string($normal['default'])) {
                $normal['default'] = "'".$normal['default']."'";
            }

            $normal['default'] = (string) $normal['default'];
        }

        if(isset($field['options']) && is_array($field['options'])) {
            $normal['options'] = array();

            foreach($field['options'] as $option) {
                if(is_string($option)) {
                    $normal['options'][] = array(
                        'value' => $option,
                        'label' => ucwords($option)
                    );

                    continue;
                }

                $normal['options'][] = $option;
            }

            $valid = array();
            foreach($normal['options'] as $option) {
                $valid[] = $option['value'];
            }

            if($normal['type'] !== 'file') {
                $normal['valid'][] = array('one', $valid);
            }
        }

        return $normal;
    }
437347
def _SanitizeField(self, field):
    
    if self._FIELD_DELIMITER and isinstance(field, py2to3.STRING_TYPES):
      return field.replace(self._FIELD_DELIMITER, ' ')
    return field
238420
public function getFiltersForField(string $field): array
    {
        $filters = [];
        foreach ($this->filters as $filter) {
            if ($field === $filter->getField()) {
                $filters[] = $filter;
            }
        }

        return $filters;
    }
950647
public function removeHeader($field)
    {
        $ucField = strtoupper($field);

        if ($ucField === 'SET-COOKIE') {
            $this->cookies = [];
        } elseif (isset($this->ucHeaders[$ucField])) {
            $field = $this->ucHeaders[$ucField];
            unset(
                $this->ucHeaders[$ucField],
                $this->headers[$field]
            );
        }

        return $this;
    }
855545
private function getFieldName(string $field): string
    {
        if (preg_match('/^:/', $field)) {
            return str_replace(':', '', $field);
        }

        if (false === strpos($field, '.')) {
            return $this->tableAlias . '.' . $field;
        }

        return $field;
    }
115415
private function convertToCustomField($field)
    {
        if (!empty($field->attributes())) {
            if (isset($field->attributes()->{'field-name'}) && isset($field->attributes()->{'field-value'})) {
                $rawName = (string)$field->attributes()->{'field-name'};
                list($normalizedName, $prefix) = $this->splitFieldNameAndPrefix($rawName);
                $value = (string)$field->attributes()->{'field-value'};
                if (!empty($normalizedName)) {
                    return new CustomField($normalizedName, $value, $prefix);
                }
            }
        }
        return null;
    }