From a140b544794989a32a3648c66cbf6a334c22995e Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 3 May 2020 10:00:45 -0400 Subject: [PATCH] doc: note that '\ ' is legal in extended mode I'm actually not sure when it became legal to escape a ' ' when extended mode is enabled, but the docs didn't mention it, and they should. Fixes #523 --- CHANGELOG.md | 9 +++++++++ src/lib.rs | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2db86880f0..abd906fc3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +TBD +=== + +Bug fixes: + +* [BUG #523](https://github.com/rust-lang/regex/pull/523): + Add note to documentation that spaces can be escaped in `x` mode. + + 1.3.7 (2020-04-17) ================== This release contains a small bug fix that fixes how `regex` forwards crate diff --git a/src/lib.rs b/src/lib.rs index 2a74bf8185..649995bdca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -152,8 +152,9 @@ assert_eq!(after, "03/14/2012, 01/01/2013 and 07/05/2014"); ``` If you wish to match against whitespace in this mode, you can still use `\s`, -`\n`, `\t`, etc. For escaping a single space character, you can use its hex -character code `\x20` or temporarily disable the `x` flag, e.g., `(?-x: )`. +`\n`, `\t`, etc. For escaping a single space character, you can escape it +directly with `\ `, use its hex character code `\x20` or temporarily disable +the `x` flag, e.g., `(?-x: )`. # Example: match multiple regular expressions simultaneously