using grep to find strings with backslashes - Character Escaping
问题 I am having difficulties to use \ as a chatterer within a regular expression. Any ideas how to make that work? grep(pattern = '\', "text with \ backslash", value = T ) # Expected output: [1] "text with backslash" 回答1: A single \ in an R string is invalid because \ is an escape character. A single backslash is actually represented by two backslashes \\ . The first one serves as an escape character, the second one is the actual backslash. The function cat can be used to print the final string