const rules = {
age: [
rule('regex', /[a-z]+/)
]
}
// or
const rules = {
age: [
rule('regex', new RegExp('[a-z]+'))
]
}
Ensures the value of field under validation, passes the regex test. The regex can be defined as a string or a RegExp object.
For complex regex , always use the rule method.
|
const rules = {
age: [
rule('regex', /[a-z]+/)
]
}
// or
const rules = {
age: [
rule('regex', new RegExp('[a-z]+'))
]
}
For customized build, you can import this rule as follows.
import { regex } from 'indicative/builds/validations'