Literals are simply characters themselves, such as “a” or “boat” or “123.” Some characters are “reserved” with special meanings, such as “+.” In the case of the plus sign, its special meaning is “additional characters like one just to the left of the + sign.” If you want to use any of these reserved characters as a literal in a RegEx, you need to escape them with a backslash. If you want to match 1+1=2, the correct RegEx is 1\\+1=2. Otherwise, the plus sign has a special meaning.1 Remember that two backslashes are required. ...
© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
W. YarberryCRAN Recipeshttps://doi.org/10.1007/978-1-4842-6876-6_88. Elements of Regular Expressions
William Yarberry1
(1)
Kingwood, TX, USA
Get CRAN Recipes: DPLYR, Stringr, Lubridate, and RegEx in R now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.