The operators =~ and !~ check values against regular expressions.

The expression a =~ b is true if the value of a matches the regular expression b.
a !~ b is true if the value of a does not match the regular expression b.

Just like comparison operators (such as < and >=) can be used to define bounds, the regular expression operators may also be used to define a set of strings through their unary forms.

file.cue
fooBar:  "foo bar" =~ "^[a-z ]{1,100}$"
bazQuux: "baz Quux" !~ "[A-Z]"

#lowercaseLength3: =~"^[[:lower:]]{3}$"
#noNumbers:        !~"[0-9]"

foo:       "foo" & #lowercaseLength3
BAR:       "BAR" & #lowercaseLength3
baaz:      "baaz" & #lowercaseLength3
theAnswer: "42" & #noNumbers
TERMINAL
$ cue eval -ic file.cue
fooBar:    true
bazQuux:   false
foo:       "foo"
BAR:       _|_ // BAR: invalid value "BAR" (out of bound =~"^[[:lower:]]{3}$")
baaz:      _|_ // baaz: invalid value "baaz" (out of bound =~"^[[:lower:]]{3}$")
theAnswer: _|_ // theAnswer: invalid value "42" (out of bound !~"[0-9]")

Futher details of how CUE supports regular expressions can be found in the regexp package documentation, and in the CUE language specification (Comparison operators and Pattern constraints). All regular expressions in CUE use Golang’s RE2 syntax.