-
Originally opened by @khepin in cuelang/cue#657 How would I put a constraint on a string's length? Right now I've only figured out how to do it via regexes: #StrLen8: =~"^.{8}$"
{
v: #StrLen8
} {
"v": "hello123"
} This also requires 1 regex / length unless I'm missing something... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Original reply by @mpvl in cuelang/cue#657 (comment)
There is a PR pending to add But you could make regex's variable:
Scalar values may have definition fields associated with them. This is a fairly new feature and some syntax has been proposed to make this more natural. |
Beta Was this translation helpful? Give feedback.
-
Original reply by @mpvl in cuelang/cue#657 (comment) Note that the |
Beta Was this translation helpful? Give feedback.
Original reply by @mpvl in cuelang/cue#657 (comment)
There is a PR pending to add
NumRunes
too.But you could make regex's variable:
Scalar values may have definition fields associated with them. This is a fairly new feature and some syntax has been proposed to make this more natural.