poppinss / indicative

Indicative is a simple yet powerful data validator for Node.js and browsers. It makes it so simple to write async validations on nested set of data.
https://indicative.adonisjs.com/
MIT License
417 stars 52 forks source link

validating a field using required and regex #81

Closed zerr0s closed 7 years ago

zerr0s commented 7 years ago

Hi, forgive me for my bad english.

Is there a way to validate a field using required and regex like that: { "user": "required|alpha_numeric", "password": "required|alpha_numeric", "id": "required|[regex:^[0-9a-z\\-]+$]", "name": "required|[regex:^[0-9a-zA-Z\\_\\-\\.]+$]" }

Actually this is not working for the required tag. The regex is working well. Thanks.

zerr0s commented 7 years ago

wowww. I was testing with the wrong schema. Finally "id": "required|[regex:^[0-9a-z\\-]+$]"

is working well.