Need to escape space even in character class

Fixes #967
This commit is contained in:
Hadley Wickham 2022-08-09 09:21:27 -05:00
parent 2b04c35228
commit c6b1f501c2
1 changed files with 2 additions and 2 deletions

View File

@ -607,9 +607,9 @@ Spaces and new lines are ignored, as is everything after `#`.
phone <- regex(r"( phone <- regex(r"(
\(? # optional opening parens \(? # optional opening parens
(\d{3}) # area code (\d{3}) # area code
[) -]? # optional closing parens, space, or dash [)\ -]? # optional closing parens, space, or dash
(\d{3}) # another three numbers (\d{3}) # another three numbers
[ -]? # optional space or dash [\ -]? # optional space or dash
(\d{3}) # three more numbers (\d{3}) # three more numbers
)", comments = TRUE) )", comments = TRUE)