I can't figure out why all of these work the same.
str_extract("\vb", "\v")
str_extract("\vb", "\\v")
str_extract("\vb", "\\\v")
I can't figure out why all of these work the same.
str_extract("\vb", "\v")
str_extract("\vb", "\\v")
str_extract("\vb", "\\\v")
Hello sandorDao,
Welcome to the community!
This seems to be a quirk in how R's ICU regex engine is parsing escape characters. Here is some more info on escaping using stringr. In the first case, \v
is referring to a vertical tab character. In the second, \\v
, the two backslashes are escaped into one so it's looking for \
and a v
. The link above will help with the last case. It looks like a sort of recursive escaping is happening in this case.
Hope this helps!
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.