OpenQuizz
Une application de gestion des contenus pédagogiques
Regexp Class Reference
Inheritance diagram for Regexp:
Collaboration diagram for Regexp:

Public Member Functions

def __init__ (self, typing.Union[str, bytes, typing.Pattern] regex, int flags=0, *typing.Optional[str] error=None)
 
str __call__ (self, str value)
 
bytes __call__ (self, bytes value)
 
def __call__ (self, value)
 
- Public Member Functions inherited from Validator
str __repr__ (self)
 
typing.Any __call__ (self, typing.Any value)
 

Data Fields

 regex
 
 error
 

Static Public Attributes

 default_message
 
- Static Public Attributes inherited from Validator
 error
 

Detailed Description

Validator which succeeds if the ``value`` matches ``regex``.

.. note::

    Uses `re.match`, which searches for a match at the beginning of a string.

:param regex: The regular expression string to use. Can also be a compiled
    regular expression pattern.
:param flags: The regexp flags to use, for example re.IGNORECASE. Ignored
    if ``regex`` is not a string.
:param error: Error message to raise in case of a validation error.
    Can be interpolated with `{input}` and `{regex}`.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
typing.Union[str, bytes, typing.Pattern]  regex,
int   flags = 0,
*typing.Optional[str]   error = None 
)

Member Function Documentation

◆ __call__() [1/3]

bytes __call__ (   self,
bytes  value 
)

◆ __call__() [2/3]

str __call__ (   self,
str  value 
)

◆ __call__() [3/3]

def __call__ (   self,
  value 
)

Field Documentation

◆ default_message

default_message
static

◆ error

error

◆ regex

regex

The documentation for this class was generated from the following file: