Comments (3)
Changing the current validator would be a breaking change.
But I can see benefit for such a validator so feel free to open a PR for that
from validator.
I custom validator @shamir92
var regexAlphaNumSpace = regexp.MustCompile("^[ \\p{L}\\p{N}]+$")
var Ins *validator.Validate
func init() {
Ins = validator.New()
Ins.RegisterValidation("alphanumspace", ValidateAlphaNumSpace)
}
func ValidateAlphaNumSpace(fl validator.FieldLevel) bool {
return regexAlphaNumSpace.MatchString(fl.Field().String())
}
Use:
type Request struct {
Name string `json:"name" validate:"required,alphanumspace"`
}
from validator.
Hi @zemzale. Can I add a new validation for alpha spaces?
from validator.
Related Issues (20)
- bump ```golang.org/x/crypto``` to ```v0.17.0``` to resolve ```CVE-2023-48795```
- validate.Struct() always returns nil for err.
- How to take the fields in the structure that are converted to json when translating. For example, in the code I provided, I want to get phone instead of Phone HOT 1
- Is it possible to allow null but deny empty string with null.String or sql.NullString? HOT 5
- how to validate inner slice item use required_if?
- dirpath fails on non-existing directory HOT 4
- RFC1035 DNS Labels can be more than 63 characters long
- Add support for numeric ports
- Not correct FQDN validation
- CVE-2023-39325 caused by dependency on mimetype
- bcp47_language_tag doesn't fail on some non-BCP47 tags HOT 1
- URN (RFC 8141) validator
- Bumping go version to 1.21 HOT 2
- Conventional Commit validator
- Import problem (Validator V10 / Go 1.22 / VS Code) HOT 1
- Execute all validators and get the collection of corresponding results HOT 1
- How can I validate a variable of type *multipart.FileHeader?
- Regex support HOT 2
- Order is not working w.r.t the required_with and len tag HOT 6
- Url does not error upon validation correctly? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from validator.