The principles of regex are basically the same between R and those other languages, so I don't see why you would switch... but if you did, asking here would be inappropriate.
I think the short answer is yes, but can't be specific without a reproducible example. ([1] is recommended but not required.) Keep in mind that R has a syntax for strings that uses \ for escaping the following character. Thus, "\\" is a single-character string with a backslash in it. However, grep also uses backslash for escaping, so if you want to search for a single backslash in a target string then grep needs two backslashes, but each of those has to be escaped in an R string so you would use four backslashes in R source code strings to match one in the target. [1] package reprex On August 26, 2019 10:56:24 PM PDT, April Ettington <apriletting...@gmail.com> wrote: >Is there any way to parse files that include the \ character in a >string? > >When I try to use grep to extract strings with a pattern that includes >"\" >it fails. > >If there is no way to do it with R, is it possible with python or a >bash >script? > >Thank you, > >April > > [[alternative HTML version deleted]] > >______________________________________________ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.