Skip to content

Commit 7dc3f11

Browse files
committed
doc: clarify verbose mode
This clarifies that `x` is "verbose mode," and that whitespace becomes insignificant everywhere, including in character classes. We also add guidance for how to insert a space: either escape it or use a hex literal. Fixes #660
1 parent 553271c commit 7dc3f11

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,13 @@ m multi-line mode: ^ and $ match begin/end of line
388388
s allow . to match \n
389389
U swap the meaning of x* and x*?
390390
u Unicode support (enabled by default)
391-
x ignore whitespace and allow line comments (starting with `#`)
391+
x verbose mode, ignores whitespace and allow line comments (starting with `#`)
392392
</pre>
393393
394+
Note that in verbose mode, whitespace is ignored everywhere, including within
395+
character classes. To insert whitespace, use its escaped form or a hex literal.
396+
For example, `\ ` or `\x20` for an ASCII space.
397+
394398
Flags can be toggled within a pattern. Here's an example that matches
395399
case-insensitively for the first part but case-sensitively for the second part:
396400

0 commit comments

Comments
 (0)