Sample Header Ad - 728x90

How to match a literal string containing an unclosed quote with ripgrep?

7 votes
3 answers
3067 views
I have a file that contains the some python code. There is a line that contains the following(including the quotes) 'hello "value"' I want to search 'hello "value" in the file. Notice the unclosed quote. I'm using ripgrep with the folowing command: rg -F 'hello "value" The above command is not working for the input 'hello "value" in bash/ zsh. All i want is the literal match. I have used the flag F but because of unclosed quotes in the input string it is not working at all. I also tried enclosing the input inside single/ double quotes as so: rg -F "'hello "value"" or rg -F ''hello "value"' The above is not working as well. I thought the F flag would tell ripgrep to consider the input literally as it is? How do I fix this?
Asked by Haris Muzaffar (249 rep)
May 20, 2021, 03:13 PM
Last activity: Nov 7, 2022, 04:00 PM