Validate tags with regex
This commit is contained in:
parent
5295e32d86
commit
25e29afcbb
@ -22,6 +22,9 @@ internal object NoteValidations {
|
|||||||
NoteMetadata::tags onEach {
|
NoteMetadata::tags onEach {
|
||||||
maxLength(15)
|
maxLength(15)
|
||||||
addConstraint("must not be blank") { it.isNotBlank() }
|
addConstraint("must not be blank") { it.isNotBlank() }
|
||||||
|
addConstraint("must only contain alphanumeric characters, `-` and `_`") {
|
||||||
|
it.matches("^[a-zA-Z0-9-_]+\$".toRegex())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user