Opened 17 years ago

Last modified 14 years ago

#5709 closed

modify newforms.RegexField to support inverse matching — at Initial Version

Reported by: Nathan Hoover <nathan@…> Owned by: nobody
Component: Forms Version: dev
Severity: Keywords: RegexField
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For conveinence, it would be nice if the RegexField supported inverse matching; i.e. the contents of the field do NOT match the regex when they're valid. I needed this in the course of using a RegexField for username signups. I have a list of undesirable usernames, like so:

INVALID_USERNAME_REGEX = '(admin|root|add|edit|administrator|service)'

Since it's not trival to make a regex that uses against words rather than characters this is useful.

Change History (1)

by Nathan Hoover <nathan@…>, 17 years ago

Attachment: fields.py.diff added

diff to patch fields.py

Note: See TracTickets for help on using tickets.
Back to Top