@@ -34,9 +34,9 @@ they can also be unquoted:
34
34
35
35
" A double-quoted string in YAML"
36
36
37
- Quoted styles are useful when a string starts or ends with one or more
38
- relevant spaces, because unquoted strings are trimmed on both ends when parsing
39
- their contents.
37
+ Quoted styles are useful when a string starts or end with one or more relevant
38
+ spaces, because unquoted strings are trimmed on both end when parsing their
39
+ contents. Quotes are required when the string contains special or reserved characters .
40
40
41
41
When using single-quoted strings, any single quote ``' `` inside its contents
42
42
must be doubled to escape it:
@@ -49,25 +49,8 @@ Strings containing any of the following characters must be quoted. Although you
49
49
can use double quotes, for these characters it is more convenient to use single
50
50
quotes, which avoids having to escape any backslash ``\ ``:
51
51
52
- * ``: ``
53
- * ``{ ``
54
- * ``} ``
55
- * ``[ ``
56
- * ``] ``
57
- * ``, ``
58
- * ``& ``
59
- * ``* ``
60
- * ``# ``
61
- * ``? ``
62
- * ``| ``
63
- * ``- ``
64
- * ``< ``
65
- * ``> ``
66
- * ``= ``
67
- * ``! ``
68
- * ``% ``
69
- * ``@ ``
70
- * ``\` ``
52
+ * ``: ``, ``{ ``, ``} ``, ``[ ``, ``] ``, ``, ``, ``& ``, ``* ``, ``# ``, ``? ``, ``| ``,
53
+ ``- ``, ``< ``, ``> ``, ``= ``, ``! ``, ``% ``, ``@ ``, ``\` ``
71
54
72
55
The double-quoted style provides a way to express arbitrary strings, by
73
56
using ``\ `` to escape characters and sequences. For instance, it is very useful
@@ -80,42 +63,11 @@ when you need to embed a ``\n`` or a Unicode character in a string.
80
63
If the string contains any of the following control characters, it must be
81
64
escaped with double quotes:
82
65
83
- * ``\0 ``
84
- * ``\x01 ``
85
- * ``\x02 ``
86
- * ``\x03 ``
87
- * ``\x04 ``
88
- * ``\x05 ``
89
- * ``\x06 ``
90
- * ``\a ``
91
- * ``\b ``
92
- * ``\t ``
93
- * ``\n ``
94
- * ``\v ``
95
- * ``\f ``
96
- * ``\r ``
97
- * ``\x0e ``
98
- * ``\x0f ``
99
- * ``\x10 ``
100
- * ``\x11 ``
101
- * ``\x12 ``
102
- * ``\x13 ``
103
- * ``\x14 ``
104
- * ``\x15 ``
105
- * ``\x16 ``
106
- * ``\x17 ``
107
- * ``\x18 ``
108
- * ``\x19 ``
109
- * ``\x1a ``
110
- * ``\e ``
111
- * ``\x1c ``
112
- * ``\x1d ``
113
- * ``\x1e ``
114
- * ``\x1f ``
115
- * ``\N ``
116
- * ``\_ ``
117
- * ``\L ``
118
- * ``\P ``
66
+ * ``\0 ``, ``\x01 ``, ``\x02 ``, ``\x03 ``, ``\x04 ``, ``\x05 ``, ``\x06 ``, ``\a ``,
67
+ ``\b ``, ``\t ``, ``\n ``, ``\v ``, ``\f ``, ``\r ``, ``\x0e ``, ``\x0f ``, ``\x10 ``,
68
+ ``\x11 ``, ``\x12 ``, ``\x13 ``, ``\x14 ``, ``\x15 ``, ``\x16 ``, ``\x17 ``, ``\x18 ``,
69
+ ``\x19 ``, ``\x1a ``, ``\e ``, ``\x1c ``, ``\x1d ``, ``\x1e ``, ``\x1f ``, ``\N ``,
70
+ ``\_ ``, ``\L ``, ``\P ``
119
71
120
72
Finally, there are other cases when the strings must be quoted, no matter if
121
73
you're using single or double quotes:
0 commit comments