RegExp Schema
Create a schema that matches a regular expression.
See at Base Schema for the inherited methods you may call like:
title()
detail()
required()
forbidden()
default()
raw()
Instead of giving a regular expression directly it may also be given as a string.
1. Checking matched groups
You may define the number of matched groups within the regular expression.
1.1. min(limit) / max(limit) / length(limit)
Specifies the number of matched groups the regular expression contains.
limit
gives the fixnumber
min
andmax
defines a range
const schema = new RegExpSchema().min(1).max(3)
schema.min().max() // to remove both settings
const schema = new RegExpSchema().length(3)
References are also possible:
const ref = new Reference(5)
const schema = new RegExpSchema().length(ref)