A leading dash (-) in the desired pattern causes ripgrep to think there is no pattern. #1676
-
What version of ripgrep are you using?12.1.1 How did you install ripgrep?via pacman What operating system are you using ripgrep on?5.8.5-arch1-1 Describe your bug.A leading dash (-) in the desired pattern causes ripgrep to think there is no pattern. What are the steps to reproduce the behavior?The easiest is to search through the help output of a command. What is the actual behavior?
What is the expected behavior?Returns the matched line(s) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
From the man page (and the That is, you want grep has the same problems and the same work-arounds. See also #1560, which is a duplicate of this issue. |
Beta Was this translation helpful? Give feedback.
From the man page (and the
--help
output):That is, you want
rg -h | rg -e -S
. Alternatively, you can use the old Unix convention of--
, where everything after it is always interpreted as a positional argument. e.g.,rg -h | rg -- -S
. Finally one other trick is to tweak the regex syntax to fool the arg parser:rg -h | rg '[-]S'
.grep has the same problems and the same work-arounds.
See also #1560, which is a duplicate of this issue.