doc/tutorial/basics: added raw strings and regexps

Change-Id: Ibd86c718eaa4bb471b30c0b92cacb258dd12f714
Reviewed-on: https://cue-review.googlesource.com/c/1544
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/doc/tutorial/basics/bytes.md b/doc/tutorial/basics/bytes.md
index 7fc7146..281d4a2 100644
--- a/doc/tutorial/basics/bytes.md
+++ b/doc/tutorial/basics/bytes.md
@@ -1,4 +1,4 @@
-[TOC](Readme.md) [Prev](stringlit.md) [Next](scopes.md)
+[TOC](Readme.md) [Prev](stringraw.md) [Next](scopes.md)
 
 _JSON Sugar and other Goodness_
 
diff --git a/doc/tutorial/basics/lists.md b/doc/tutorial/basics/lists.md
index dd1889f..812663c 100644
--- a/doc/tutorial/basics/lists.md
+++ b/doc/tutorial/basics/lists.md
@@ -1,4 +1,4 @@
-[TOC](Readme.md) [Prev](rangedef.md) [Next](templates.md)
+[TOC](Readme.md) [Prev](regexp.md) [Next](templates.md)
 
 _Types ~~and~~ are Values_
 
diff --git a/doc/tutorial/basics/rangedef.md b/doc/tutorial/basics/rangedef.md
index 038e96b..d29e4e8 100644
--- a/doc/tutorial/basics/rangedef.md
+++ b/doc/tutorial/basics/rangedef.md
@@ -1,4 +1,4 @@
-[TOC](Readme.md) [Prev](ranges.md) [Next](lists.md)
+[TOC](Readme.md) [Prev](ranges.md) [Next](regexp.md)
 
 _Types ~~and~~ are Values_
 
diff --git a/doc/tutorial/basics/regexp.md b/doc/tutorial/basics/regexp.md
new file mode 100644
index 0000000..08ee835
--- /dev/null
+++ b/doc/tutorial/basics/regexp.md
@@ -0,0 +1,39 @@
+[TOC](Readme.md) [Prev](rangedef.md) [Next](lists.md)
+
+_Expressions_
+
+# Regular expressions
+
+The `=~` and `!~` operators can be used to check against regular expressions.
+
+The expression `a =~ b` is true if `a` matches `b`, while
+`a !~ b` is true if `a` does _not_ match `b`.
+
+Just as with comparison operators, these operators maybe be used
+as unary versions to define a set of strings.
+
+
+<!-- CUE editor -->
+```
+a: "foo bar" =~ "foo [a-z]{3}"
+b: "maze" !~ "^[a-z]{3}$"
+
+c: =~"^[a-z]{3}$" // any string with lowercase ASCII of length 3
+
+d: c
+d: "foo"
+
+e: c
+e: "foo bar"
+```
+
+<!-- result -->
+```
+a: true
+b: true
+
+c: "^[a-z]{3}$"
+
+d: "foo"
+e: _|_  // "foo bar" does not match =~"^[a-z]{3}$"
+```
\ No newline at end of file
diff --git a/doc/tutorial/basics/stringlit.md b/doc/tutorial/basics/stringlit.md
index efea169..33cf7d6 100644
--- a/doc/tutorial/basics/stringlit.md
+++ b/doc/tutorial/basics/stringlit.md
@@ -1,4 +1,4 @@
-[TOC](Readme.md) [Prev](numberlit.md) [Next](bytes.md)
+[TOC](Readme.md) [Prev](numberlit.md) [Next](stringraw.md)
 
 _JSON Sugar and other Goodness_
 
diff --git a/doc/tutorial/basics/stringraw.md b/doc/tutorial/basics/stringraw.md
new file mode 100644
index 0000000..6f5b73a
--- /dev/null
+++ b/doc/tutorial/basics/stringraw.md
@@ -0,0 +1,40 @@
+[TOC](Readme.md) [Prev](stringlit.md) [Next](bytes.md)
+
+_JSON Sugar and other Goodness_
+
+# "Raw" Strings
+
+CUE does not support raw strings in the strictest sense.
+Instead it allows modifying the escape delimiter by requiring
+an arbitrary number of hash `#` signs after the backslash by
+enclosing a string literal in an equal number of hash signs on either end.
+
+This works for normal and interpolated strings.
+Quotes do not have to be escaped in such strings.
+
+<!-- CUE editor -->
+```
+msg1: #"The sequence "\U0001F604" renders as \#U0001F604."#
+
+msg2: ##"""
+    A regular expression can conveniently be written as:
+
+        #"\d{3}"#
+
+    This construct works for bytes, strings and their multi-line variants.
+    """##
+```
+
+<!-- JSON result -->
+```json
+{
+    msg1: "The sequence \"\\U0001F604\" renders as 😄."
+    msg2: """
+        A regular expression can conveniently be written as:
+        
+            #\"\\d{3}\"#
+        
+        This construct works for bytes, strings and their multi-line variants.
+        """
+}
+```