From c6b1f501c2c220805d9b4a55954e7e0d44baf85a Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Tue, 9 Aug 2022 09:21:27 -0500 Subject: [PATCH] Need to escape space even in character class Fixes #967 --- regexps.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regexps.qmd b/regexps.qmd index 946b2e0..7b9be47 100644 --- a/regexps.qmd +++ b/regexps.qmd @@ -607,9 +607,9 @@ Spaces and new lines are ignored, as is everything after `#`. phone <- regex(r"( \(? # optional opening parens (\d{3}) # area code - [) -]? # optional closing parens, space, or dash + [)\ -]? # optional closing parens, space, or dash (\d{3}) # another three numbers - [ -]? # optional space or dash + [\ -]? # optional space or dash (\d{3}) # three more numbers )", comments = TRUE)