Skip to content

Commit

Permalink
for Regexp validator set html input tag 'pattern' attribute (used if …
Browse files Browse the repository at this point in the history
…novalidate not set on a form)
  • Loading branch information
andreas loeffler committed Nov 13, 2022
1 parent aa4e043 commit fdfc1ab
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/wtforms/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ def __init__(self, regex, flags=0, message=None):
regex = re.compile(regex, flags)
self.regex = regex
self.message = message
self.field_flags = {"pattern": regex.pattern}

def __call__(self, form, field, message=None):
match = self.regex.match(field.data or "")
Expand Down

0 comments on commit fdfc1ab

Please sign in to comment.