cue-lang / docs-and-content

A place to discuss, plan, and track documentation on cuelang.org
5 stars 1 forks source link

docs/tour/expressions/regexp: page could do a better job of demonstrating core regex capabilities #120

Open jpluscplusm opened 2 months ago

jpluscplusm commented 2 months ago

In https://cuelang.slack.com/archives/CLT3ULF6C/p1710343533384899, a user asked

Is it possible to check if a string is a uppercase string?

We don't want https://cuelang.org/docs/tour/expressions/regexp/ to become a regex primer, but if we tidied up the examples with tactically valuable regex choices, we could have a page which is the same length and complexity but which would be more useful to a wider set of readers.

We could, for instance, include character classes in the examples. This would both be more i18n-friendly than the current [a-z] ASCII-centric example, and might well prompt readers to explore the set of classes available, out of the box, by following the RE2 link.

e.g.

x: =~"^[[:upper:]]+$" // x is an uppercase string