#27945 closed Cleanup/optimization (fixed)
Clarify RegexValidator docs (match vs. search)
Reported by: | Shubham Jain | Owned by: | Sean Fagan |
---|---|---|---|
Component: | Documentation | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The documentation says, RegexValidator matches the regex against the value, and hence ideally it must use regex.match but instead uses regex.search.
This looks like a bug.
Change History (8)
comment:1 by , 8 years ago
Component: | Uncategorized → Core (Other) |
---|---|
Easy pickings: | set |
Has patch: | set |
Type: | Uncategorized → Bug |
comment:2 by , 8 years ago
comment:3 by , 8 years ago
So the [documentation](https://docs.djangoproject.com/en/dev/ref/validators/#django.core.validators.RegexValidator.regex) says, "regex pattern to search for provided value". I suppose this means, you try to see if value fits in the regex. But instead it sees if regex fits anywhere in the value. So in documentation, it must be "regex pattern to search for, in the provided value".
comment:4 by , 8 years ago
Component: | Core (Other) → Documentation |
---|---|
Has patch: | unset |
Summary: | RegexValidator uses search instead of match → Clarify RegexValidator docs (match vs. search) |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
comment:5 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Where's the documentation you quoted? I see, "The regular expression pattern to search for the provided value". Presumably the documentation you mentioned should be fixed since changing behavior would be backwards incompatible.