# pydantic 2.14.2 (MIT), harvested by tools/harvest_corpus.py
=== input
!!! abstract "Usage Documentation"
        [String types](./standard_library_types.md#strings)

    A field metadata class to apply constraints to `str` types.
    Use this class as an annotation via [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated), as seen below.

    Attributes:
        strip_whitespace: Whether to remove leading and trailing whitespace.
        to_upper: Whether to convert the string to uppercase.
        to_lower: Whether to convert the string to lowercase.
        strict: Whether to validate the string in strict mode.
        min_length: The minimum length of the string.
        max_length: The maximum length of the string.
        pattern: A regex pattern that the string must match.
        ascii_only: Whether the string should contain only ASCII characters.

    Example:
        ```python
        from typing import Annotated

        from pydantic.types import StringConstraints

        ConstrainedStr = Annotated[str, StringConstraints(min_length=1, max_length=10)]
        ```
    
=== parse google
short_description: '!!! abstract "Usage Documentation"'
long_description: |
      [String types](./standard_library_types.md#strings)
  
  A field metadata class to apply constraints to `str` types.
  Use this class as an annotation via [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated), as seen below.
blank_after_short_description: False
blank_after_long_description: True
style: google
- DocstringParam
  description: 'Whether to remove leading and trailing whitespace.'
  kind: attribute
  key: 'attribute'
  arg_name: 'strip_whitespace'
  is_optional: False
- DocstringParam
  description: 'Whether to convert the string to uppercase.'
  kind: attribute
  key: 'attribute'
  arg_name: 'to_upper'
  is_optional: False
- DocstringParam
  description: 'Whether to convert the string to lowercase.'
  kind: attribute
  key: 'attribute'
  arg_name: 'to_lower'
  is_optional: False
- DocstringParam
  description: 'Whether to validate the string in strict mode.'
  kind: attribute
  key: 'attribute'
  arg_name: 'strict'
  is_optional: False
- DocstringParam
  description: 'The minimum length of the string.'
  kind: attribute
  key: 'attribute'
  arg_name: 'min_length'
  is_optional: False
- DocstringParam
  description: 'The maximum length of the string.'
  kind: attribute
  key: 'attribute'
  arg_name: 'max_length'
  is_optional: False
- DocstringParam
  description: 'A regex pattern that the string must match.'
  kind: attribute
  key: 'attribute'
  arg_name: 'pattern'
  is_optional: False
- DocstringParam
  description: 'Whether the string should contain only ASCII characters.'
  kind: attribute
  key: 'attribute'
  arg_name: 'ascii_only'
  is_optional: False
- DocstringExample
  description: |
    ```python
    from typing import Annotated
    
    from pydantic.types import StringConstraints
    
    ConstrainedStr = Annotated[str, StringConstraints(min_length=1, max_length=10)]
    ```
  kind: examples
  key: 'examples'
=== detect
google
=== compose google
!!! abstract "Usage Documentation"
    [String types](./standard_library_types.md#strings)

A field metadata class to apply constraints to `str` types.
Use this class as an annotation via [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated), as seen below.

Attributes:
    strip_whitespace: Whether to remove leading and trailing whitespace.
    to_upper: Whether to convert the string to uppercase.
    to_lower: Whether to convert the string to lowercase.
    strict: Whether to validate the string in strict mode.
    min_length: The minimum length of the string.
    max_length: The maximum length of the string.
    pattern: A regex pattern that the string must match.
    ascii_only: Whether the string should contain only ASCII characters.

Examples:
    ```python
    from typing import Annotated

    from pydantic.types import StringConstraints

    ConstrainedStr = Annotated[str, StringConstraints(min_length=1, max_length=10)]
    ```
