Skip to content

Commit

Permalink
doc: clarify verbose mode
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BurntSushi committed Apr 15, 2023
1 parent 9885cc4 commit 1af7bfa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,13 @@ m multi-line mode: ^ and $ match begin/end of line
s allow . to match \n
U swap the meaning of x* and x*?
u Unicode support (enabled by default)
x ignore whitespace and allow line comments (starting with `#`)
x verbose mode, ignores whitespace and allow line comments (starting with `#`)
</pre>
Note that in verbose mode, whitespace is ignored everywhere, including within
character classes. To insert whitespace, use its escaped form or a hex literal.
For example, `\ ` or `\x20` for an ASCII space.
Flags can be toggled within a pattern. Here's an example that matches
case-insensitively for the first part but case-sensitively for the second part:
Expand Down

0 comments on commit 1af7bfa

Please sign in to comment.